SQLServerCentral.com / SQL Server 2005 / SQL Server 2005 Performance Tuning / Covering Index vs Included Columns / Latest PostsInstantForum.NET v2.9.0SQLServerCentral.comhttp://www.sqlservercentral.com/Forums/notifications@sqlservercentral.comTue, 31 Mar 2015 12:45:42 GMT20RE: Covering Index vs Included Columnshttp://www.sqlservercentral.com/Forums/Topic509318-360-1.aspxI was anticipating this kind of reply :-)just stumbled on this thread, didn't realized its 6yrs old :w00t:But the fact remains same right, then & now? :cool:Tue, 05 Aug 2014 11:13:14 GMTmanub22RE: Covering Index vs Included Columnshttp://www.sqlservercentral.com/Forums/Topic509318-360-1.aspxPlease note: 6 year old thread.Edit:[quote]Theoretically Covering Index & Included Columns are same. [/quote]No. Definitely not.Tue, 05 Aug 2014 11:07:23 GMTGilaMonsterRE: Covering Index vs Included Columnshttp://www.sqlservercentral.com/Forums/Topic509318-360-1.aspx+1 for Matt's response.Theoretically Covering Index & Included Columns are same. The difference should be cited as: Covering Index/Included Columns vs Composite Index.Tue, 05 Aug 2014 11:00:10 GMTmanub22RE: Covering Index vs Included Columnshttp://www.sqlservercentral.com/Forums/Topic509318-360-1.aspxAs for the covering index vs. include topic, I would recommend reading an article by Josef Richburg and the ensuing discussion on the topic. You can find the article [url=http://www.sqlservercentral.com/articles/included+columns/69179/]here[/url].I would also recommend reading up on Gail Shaws articles on the topic. You can find her first article in the series [urlhttp://www.sqlservercentral.com/articles/Indexing/68439/]here[/url].In the discussion on Josef's article, it is pointed out that the space saved is negligible between the covering index and the include. Also, Matt's answer pretty much nailed it otherwise.Tue, 13 Apr 2010 17:50:10 GMTSQLRNNRRE: Covering Index vs Included Columnshttp://www.sqlservercentral.com/Forums/Topic509318-360-1.aspx[quote][b]tfifield (5/30/2008)[/b][hr]Can anyone tell me if there is any functional or performance difference between designing a covering index and an index that includes columns that will be queried.[/quote]Hi,I'd like to point out that a covered index contains all columns in every node of the index while a index with included columns only contains all columns on the leaf level.I.e. a Covered index is wider in every node, hence takes more space and will be less performant for queries of the typeSELECT col1,col2,col3FROM tab1WHERE col1=... AND col2=...(where col1 and col2 are in both types of indexes and col3 is in the covered index but Included in the 'Included Columns Index')Regards,HanslindgrenTue, 13 Apr 2010 03:12:31 GMTHans LindgrenRE: Covering Index vs Included Columnshttp://www.sqlservercentral.com/Forums/Topic509318-360-1.aspx[quote][b]Matt Miller (#4) (5/30/2008)[/b][hr][code]CREATE NONCLUSTERED INDEX IX_OrderDetailDateProdSold ON dbo.OrderDetail( OrderDate ASC, ProductID ASC) INCLUDE (QtySold);[/code][/quote]Matt,Any specific reasons you wouldn't go for:[code]CREATE NONCLUSTERED INDEX IX_OrderDetailDateProdSold ON dbo.OrderDetail( [b]ProductID ASC, OrderDate ASC[/b]) INCLUDE (QtySold);[/code]which (quite probably.Here I assume more products then dates in your solution) would have a much higher cardinality and would be far more effictive?Regards,HansTue, 13 Apr 2010 03:03:57 GMTHans LindgrenRE: Covering Index vs Included Columnshttp://www.sqlservercentral.com/Forums/Topic509318-360-1.aspxThanks guys. It makes sense I'll give it a whirl.Todd FifieldSat, 31 May 2008 11:01:42 GMTtfifieldRE: Covering Index vs Included Columnshttp://www.sqlservercentral.com/Forums/Topic509318-360-1.aspxI think Matt covered it very well. Another way to explain it that the included columns should be columns that you don't search on, but will return. I think a good example are middle_name and suffix columns. You probably return it but your searching, ordering, and grouping will usually be by last_name, first_name which would be your index with middle_name and suffix as the included columns.Fri, 30 May 2008 13:06:14 GMT Jack CorbettRE: Covering Index vs Included Columnshttp://www.sqlservercentral.com/Forums/Topic509318-360-1.aspxThere should be, although how much might be debatable. Ultimately - I think the "sweet spot" is the version you didn't include:[code]CREATE NONCLUSTERED INDEX IX_OrderDetailDateProdSold ON dbo.OrderDetail( OrderDate ASC, ProductID ASC) INCLUDE (QtySold);[/code]The short version as I understand it to make the "ideal" covering would be: - columns appearing in the WHERE, FROM, GROUP BY and ORDER BY should appear in the "main part" of the index. - columns not otherwise included that appear in the SELECT or HAVING go in the UNCLUDE clause.Technically - since the "main part" is what the B-tree is based on - by keeping the main part as skinny as you can, you get better perf, while avoiding the bookmark lookup with the INCLUDE stuff.Fri, 30 May 2008 12:53:18 GMTMatt Miller (#4)Covering Index vs Included Columnshttp://www.sqlservercentral.com/Forums/Topic509318-360-1.aspxHi Guys!Can anyone tell me if there is any functional or performance difference between designing a covering index and an index that includes columns that will be queried.Let's say I wanted to sum up the total quantity ordered by product in a date range.SELECT ProductID, SUM(QtySold) AS MarchQtyFROM OrderDetailWHERE OrderDate &gt;= '3/1/08'AND OrderDate &lt; '4/1/08GROUP BY ProductIDWould there by any performance difference between:CREATE NONCLUSTERED INDEX IX_OrderDetailDateProdSold ON dbo.OrderDetail( OrderDate ASC, ProductID ASC, QtySold ASC );andCREATE NONCLUSTERED INDEX IX_OrderDetailDateWithProdSold ON dbo.OrderDeail(OrderDate) ASCINCLUDE (ProductID, QtySold);Fri, 30 May 2008 12:39:44 GMTtfifield