On May 23, 6:00*am, codefragm...@googlemail.com wrote:
Hi
* I thought that given a table with an index, primary key and
clustered index any non clustered index look ups would go via the
clustered index and the primary key is irrelevant?
(sql server 2000). A colleague has said that the primary key should be
the clustered index
because all index lookups will go via the primary key.
* Is this right? I thought the primary key was nothing more than a
constraint on what data can be entered into the table.
* Does it matter if the primary key is the same as the clustered
index?
ta
You are correct. Indexes will be based on the clustered index of the
table, which may or may not be the primary key. If the clustered index
is not unique then a row identifier is added to the primary key to
point into the table from the index. I don't recall the exact
structure of that row identifier, but you can probably find a better
description out there somewhere. Try a Google on "SQL Server index
architecture" or something similar. The "Insiders Guide to..." series
of books used to have sections on the inner architectures of SQL
Server I believe. I don't see a version of it for SQL 2005 though, so
maybe that series was discontinued? Or maybe my memory is just
wrong. :)
-Tom.