SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Clustered indexes


Clustered indexes

Author
Message
Tom Thomson
Tom Thomson
One Orange Chip
One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)

Group: General Forum Members
Points: 26184 Visits: 12501
Cliff Jones (5/6/2010)
What threw me off was "All nonclustered indexes include the clustered index columns in their index pages" . I thought this was incorrect because the clustered index columns are contained in the Leaf Node Data Pages and not every index page.

This nearly threw me off too, but I decided that as it didn't say "in all their index pages" it was actually correct and picked the right answer. I can't say that I particularly like questions where one has to take a lawyer-like attitude to the phrasing, but any dba or developer has to read the small print in requirement statements so maybe it's good practice for us and therefor I don't particularly dislike them either (unless they are really silly extreme cases of it, which this one isn't).

Tom

The Dixie Flatline
The Dixie Flatline
SSChampion
SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)

Group: General Forum Members
Points: 13118 Visits: 6903
Tom.Thomson (5/11/2010)
Cliff Jones (5/6/2010)
What threw me off was "All nonclustered indexes include the clustered index columns in their index pages" . I thought this was incorrect because the clustered index columns are contained in the Leaf Node Data Pages and not every index page.

This nearly threw me off too, but I decided that as it didn't say "in all their index pages" it was actually correct and picked the right answer. I can't say that I particularly like questions where one has to take a lawyer-like attitude to the phrasing, but any dba or developer has to read the small print in requirement statements so maybe it's good practice for us and therefor I don't particularly dislike them either (unless they are really silly extreme cases of it, which this one isn't).



I missed this one as well, because I read the clustered index columns to mean all columns, not just the columns comprising the clustered index key. Since the clustered index is the base table, and since all non-clustered indexes do NOT include all columns in the base table... I died.

Really good question though.

__________________________________________________

Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
Cliff Jones
Cliff Jones
SSCertifiable
SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)

Group: General Forum Members
Points: 5227 Visits: 3648
The Dixie Flatline (5/14/2010)
Tom.Thomson (5/11/2010)
Cliff Jones (5/6/2010)
What threw me off was "All nonclustered indexes include the clustered index columns in their index pages" . I thought this was incorrect because the clustered index columns are contained in the Leaf Node Data Pages and not every index page.

This nearly threw me off too, but I decided that as it didn't say "in all their index pages" it was actually correct and picked the right answer. I can't say that I particularly like questions where one has to take a lawyer-like attitude to the phrasing, but any dba or developer has to read the small print in requirement statements so maybe it's good practice for us and therefor I don't particularly dislike them either (unless they are really silly extreme cases of it, which this one isn't).



I missed this one as well, because I read the clustered index columns to mean all columns, not just the columns comprising the clustered index key. Since the clustered index is the base table, and since all non-clustered indexes do NOT include all columns in the base table... I died.

Really good question though.



Hugo concedes that that particular answer was not worded correctly, so that is good enough for me.
m.bouffard
m.bouffard
Valued Member
Valued Member (70 reputation)Valued Member (70 reputation)Valued Member (70 reputation)Valued Member (70 reputation)Valued Member (70 reputation)Valued Member (70 reputation)Valued Member (70 reputation)Valued Member (70 reputation)

Group: General Forum Members
Points: 70 Visits: 53
Hmm...

"A clustered index determines the physical order of data in a table. A clustered index is analogous to a telephone directory, which arranges data by last name. Because the clustered index dictates the physical storage order of the data in the table, a table can contain only one clustered index. ."

"A clustered index is particularly efficient on columns that are often searched for ranges of values. After the row with the first value is found using the clustered index, rows with subsequent indexed values are guaranteed to be physically adjacent."

http://msdn.microsoft.com/en-us/library/aa933131(SQL.80).aspx
Hugo Kornelis
Hugo Kornelis
SSCoach
SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)

Group: General Forum Members
Points: 18959 Visits: 12426
m.bouffard (8/25/2010)
Hmm...

"A clustered index determines the physical order of data in a table. A clustered index is analogous to a telephone directory, which arranges data by last name. Because the clustered index dictates the physical storage order of the data in the table, a table can contain only one clustered index. ."

"A clustered index is particularly efficient on columns that are often searched for ranges of values. After the row with the first value is found using the clustered index, rows with subsequent indexed values are guaranteed to be physically adjacent."

http://msdn.microsoft.com/en-us/library/aa933131(SQL.80).aspx

The first quote is correct. The clustered index does "dictate" the physical storage order. That does not imply that the ordering of the physical storage matches that of the index. Data pages can be scatered through the file; traversing the index in order is done by following the "next page"/"previous page" pointers in the data pages.

The second quote is incorrect. Rosw with subsequent indexed values are guaranteed to be on the same page or on the next page when following the the pointer chain. They might be physically adjacent, but there is no guarantee at all.

Here is how the current version of Books Online describes clustered indexes: http://msdn.microsoft.com/en-us/library/ms177443.aspx


Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search