Difference between clustered and non-clustered index

5 pts.
Tags:
Cluster computing
What is the difference between a Clustered Index and a Non-Clustered Index?

Answer Wiki

Thanks. We'll let you know when a new response is added.

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 non-clustered index on Microsoft’s site.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following