views:

713

answers:

2

Hi,

what are the main differences between a clustered index and an index seek?

A: 

A non-clustered index is a kind of index where each leaf node of the index points to a row in the corresponding table.

A clustered index is a kind of index where each leaf node of the index is the row in the corresponding table. Obviously there can only be one clustered index for any given table (but there doesn't have to be one).

An index seek is a method of looking for rows in a table where an index is consulted, individual pointers to individual rows are found, and only the pages containing the corresponding rows are loaded into memory. An index seek is an efficient method of looking up rows in a query if the number of rows expected is small, and if they tend to be clustered together on a few pages instead of being spread out across all the pages in a table.

Justice
+1  A: 

A clustered index physically places the indexes on disk in the sorted order so go through them faster. It is best when used to iterate over the indexes in sorted order since the disk seeks will be continuous.

An index seek in simply a way to look for an index. This might be a b+tree, a hash, whatever method an index could be looked up.

It's possible to have an index seek over a clustered index, they are not mutually exclusive.

Ben S