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
-
H ave been trying to download Office 2007 Beta 1 Refresh for the past few days but the line traffic condition was so bad. With just below 10...
-
Check out new Tiger Baby single Landscapes ...taken from the band's new album Open Windows Open Hills . Predictably, this is catc...
-
Is it Hunting Season again? Everyone I know seems to be looking (or have looked) for greener pastures nowadays. I was so surprised to find ...
-
S QL Server 2005 SP1 March 2006 CTP and its accompanying SQL Server 2005 Books Online (March 2006 CTP) are now available for preview. User...
-
Time to leave the bad stuff behind, so here's the wonderful new video by Acid House Kings for their absolutely wonderful single Would Y...
-
M y Streamyx was down for approximately five days. The technician told me that it is a problem with my port over in their headquarters. Acco...
-
The Uri (Namibia) Uri. From the Namibian word for "jump", this extremely able 4x4 is perfect for the real off road path. Made in N...
-
T eam Foundation Server has finally shipped! This completes the Visual Studio Team System family. Incase you are unaware, Team Foundation S...
No comments:
Post a Comment