We can now include nonkey columns in addition to the index key columns in our nonclustered indexes to increase query performance. For example, in the following code:
SELECT ProductCode, Name, Price
FROM Products
WHERE ProductCode BETWEEN '10000' and '20000'
A nonclustered index can be created on ProductCode to enhance the performance of the query but the Name and Price columns will need to be retrieved from the table or clustered index.
However, in SQL Server 2005, the Name and Price columns can be included in the nonclustered index as Included Columns.
CREATE NONCLUSTERED INDEX IX_Product_ProductCode
ON Product (ProductCode)
INCLUDE (Name, Price)
This is not the same as defining composite keys for the index since the columns are not part of the key but just tagged to it.
Take note that Included Columns only work with nonclustered indexes and may cause performance problems in insert, update and delete operations (if over-used) due to additional maintenance overhead.
Home »Unlabelled » SQL2005: Covering.Queries
Popular Post
-
these photos are from a gallery I posted http://justacarguy.blogspot.com/2011/04/gourmet-feed-trucks-were-gathered-to.html when I accident...
-
Photo: Russell Bates, 2010. Red Car Property neighborhood beekeepers in LA Times. (Click on photo to enlarge.)
-
V12 / 5.576 cc / 385 PS / 406 ft/lb (550 Nm) @ 4.000 / 0 - 62 mph (100 km/h): 6,6 s / Vmax: 155 mph (250 km/h) (click images for a larger ...
-
Photo: Diane Edwardson, February 18, 2012. Native California Black Walnuts are sprouting leaves on the Red Car Property. (Click on photo t...
-
A special edition Racer Ford P68 has been made by Racer for Great Traditions in Philadelphia for the Racer Resin National Final race for 201...
-
Series Imola: SC-4031C2 15.8x8mm. Imola Black SC-4031C3 15.8x8mm. Imola Blue SC-4046C2 16.5x8mm. Imola Black SC-4046C3 16.5x8mm. Imola Blue...
-
S4 / 1.984 cc / 200 PS / 207 ft/lb (280 Nm) @ 1.700 - 5.000 / turbo / AWD (click images for a larger view)
-
in Northern Wisconsin, by Sturgeon Bay " I've driven this road many times when I lived in Green Bay, on my way up in Door county to...
-
We are delighted to report a new development. The ingenuity of the drivers of Aberdeen Cars never ceases to amaze! And delight! Here we see ...
-
Phil and Derek and Chris (I'm hoping I didn't leave anyone out) did a slot demo over the 4th of July holiday in their hometown in Ne...
No comments:
Post a Comment