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
-
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 ...
-
Apparently, SGDOTNET did another major upgrade to their site and the incident broke all my image links on my blog :(
-
Photo: Diane Edwardson, February 18, 2012. Native California Black Walnuts are sprouting leaves on the Red Car Property. (Click on photo t...
-
There were lots of issues to contend with up to the end, but got through with flying colors. Consumer reports had something to say about our...
-
F inally found out who smsed me - it turns out to be one of my colleagues *HuHuHu* * paiseh * * paiseh * Sorry buddy, *sweating* didn't ...
-
Advice for children from the Department for Transport via deep-cover agents at Manchester Cycling . The implication of all the clever games...
-
Stream this rough mix of new track Different City by Architecture . Cannot wait to hear the final mix. different city (rough mix...
-
BMW did manual-gearbox fans in the U.S. a favor by adding the option on its latest 2013 M5 F10 saloon as a no-cost alternative to the standa...
-
As per usual I've been sleeping under a rock and somehow completely missed that something interesting was brewing. Weird-named Danish ac...
-
I discovered data annotations while I was learning ASP.NET Web Forms Model Binding sometime back. From a little reading, I got to know tha...
No comments:
Post a Comment