unique clustered index

But whenever possible have a unique clustered index.  For example, on the state codes table, a unique clustered index on state_code would work just fine.
i am reading as above.
what is meaning of unique clustered index and how it is different from regular index. please let me know advantages of using it.

please advise
LVL 7
gudii9Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slightwv (䄆 Netminder) Commented:
I would start with the documentation and ask questions about the specifics that you do not understand:
https://docs.microsoft.com/en-us/sql/relational-databases/indexes/clustered-and-nonclustered-indexes-described
0
gudii9Author Commented:
i read less the unique clustered index number slow at data access where as more the number slow down data modification which was not clear either.

please advise
0
PortletPaulEE Topic AdvisorCommented:
A clustered index determines how the data is organized on disk which is why you can only have one clustered index for a table.

You can create a clustered index on one or more columns that permits duplication of values within that column or columns. Such a  clustered index does not constrain you from adding non-unique key data in the columns of that index.

Alternatively a unique clustered index is formed by one or more columns that contains no duplicates. Such an index, made with the "unique" keyword, means that this type of index does not permit non unique data in the column(s) of that index.

additional note:
Because a clustered index is used as the way data is stored, the clustered index must know how to identify each row. So for a non-unique clustered index a 4 byte unique identifier is added to the index so it can locate each row. This is internal only, not seen by users.
2

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The Five Tenets of the Most Secure Backup

Data loss can hit a business in any number of ways. In reality, companies should expect to lose data at some point. The challenge is having a plan to recover from such an event.

wilcoxonCommented:
To expand on what PortletPaul said:

A clustered index stores the data on disk in the index order.

Unique is a separate index qualifier (it can be used on clustered and non-clustered indexes).  It simply says that each set of index fields must be unique.

A unique clustered index can be thought of as the primary key of the table (and, in older versions of Sybase, this worked much better than actually declaring primary keys).

Since a clustered index determines how the table is physically stored, lookups are very fast (with most indexes, the index stores a pointer into the table for each index entry - with a clustered index, the index entry is the table data).  On the flip side, since the table is physically stored in the index order, inserts or updates may require reordering the physical table.
2
PortletPaulEE Topic AdvisorCommented:
>>"i read less the unique clustered index number slow at data access where as more the number slow down data modification which was not clear either."

A unique clustered index is fast for data access (if a query is able to use that index).

A table can only have one clustered index, but it can have many additional non-clustered indexes.
When a table has many indexes, inserts/updates into that table may get slower because the database needs to refresh many indexes.

Plus, as wilcoxon has already mentioned, a clustered index can also slow down inserts/updates too:
"... since the table is physically stored in the [clustered] index order, inserts or updates may require reordering the physical table."

Think of it this way:
To make a car faster we remove weight which can make it less safe.
There is a "trade-off" between speed and safety.

Indexes do help to make data access faster, but the "trade-off" can be slower inserts/updates.
0
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
Normally a unique cluster index is a unique number associated with each node in your cluster.

These values are used for debugging, so you can tell which unique cluster node actually created the row of data in question.

Without this indicator, there's no way to determine which node created which data row.
0
wilcoxonCommented:
Split the points between all people that replied with relevant information.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.