Indexing
5 pts.
0
Q:
Indexing
Whatis the difference between a Clustered Index and a Non-Clustered Index
ASKED: Jul 30 2008  5:27 PM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
46795 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
Since you didn't specify what database platform you are using, I'm coming from the SQL Server world.

A clustered index contains the entire record, while a non-clustered index contains only the columns specified in the CREATE INDEX command. In order version of SQL Server the clustered index also controlled the physical order of the data within the table. This is no longer the case (and is documented in Books OnLine). The clustered index must be created within the same filegroup as the table, while nonclustered indexes can be created in any filegroup.

You can only have one clustered index per table, while you can have hundreds of nonclustered indexes per table.

When you do a look up against a clustered index, and you need to go to the base table to get the row, the clustered index contains a pointer to the physical table and the location of the data. When you query a nonclustered index, that nonclustered index contains a pointer to the location within the clustered index which contains the data you are looking for, which then references the physical table. When using indexes on a table without a clustered index the nonclustered indexes contain references back to the physical table.

You can read up more about the physical structure of the clustered index and the nonclustered index on Microsoft's site.
Last Answered: Jul 31 2008  1:57 AM GMT by Mrdenny   46795 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Mrdenny   46795 pts.  |   Jul 31 2008  1:57AM GMT

Check out my SQL Server blog “SQL Server with Mr Denny” for more SQL Server information.

 
0