Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Difference between Cluster and Non-cluster index

Author  Topic 

ashutosh011283
Starting Member

6 Posts

Posted - 2011-07-21 : 08:11:47
Hi All,

I would like to know actual Difference between Cluster and Non-cluster indexes in sql server 2005 and why we use indexes in database ?



ashutosh upadhyay

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-07-21 : 08:20:46
Have a look at bol.
Note indexes can be used as constraints as well as for performance.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

ankit.choudhary4
Starting Member

1 Post

Posted - 2011-07-21 : 08:29:28
In Non Cluster indexing data is present in random order although they have logical order .Non cluster indexing is basically user on those table which needs to be update frequently.

In cluster indexing data is blocked to certain index to match like you can take example B tree every parent has its left child greater then parent and right child smaller than parent.

indexing is basically used to speed up data extraction from a table.
Go to Top of Page

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-07-21 : 08:52:19
Not sure any of that is correct.
In a clustered index the leaf level is the data page.

Non-clustered is a copy of the indexed and included columns plus the clustered index columns and a sequence if the clustered index is not unique or a row identifier if the base table is a heap.

Indexes are used for performance or to implement constraints.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-07-21 : 09:06:05
quote:
Originally posted by ankit.choudhary4

In Non Cluster indexing data is present in random order although they have logical order .Non cluster indexing is basically user on those table which needs to be update frequently.

In cluster indexing data is blocked to certain index to match like you can take example B tree every parent has its left child greater then parent and right child smaller than parent.


That is completely wrong.

See http://www.sqlservercentral.com/articles/Indexing/68563/ and http://www.sqlservercentral.com/articles/Indexing/68636/

--
Gail Shaw
SQL Server MVP
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2011-07-21 : 16:38:00
clustered indexes are boys
non-clustered indexes are girls

Be One with the Optimizer
TG
Go to Top of Page

Ghanta
Yak Posting Veteran

96 Posts

Posted - 2011-07-21 : 16:44:29
quote:
Originally posted by TG

clustered indexes are boys
non-clustered indexes are girls

Be One with the Optimizer
TG



So you are saying that all the boys have unique characteristics and girls can be grouped by characteristics?
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2011-07-21 : 17:08:46
quote:
Originally posted by Ghanta

quote:
Originally posted by TG

clustered indexes are boys
non-clustered indexes are girls

Be One with the Optimizer
TG



So you are saying that all the boys have unique characteristics and girls can be grouped by characteristics?



Quit bustin' my clusters! Just trying to explain where data pages come from.

Be One with the Optimizer
TG
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-07-21 : 17:37:51
You know, if you look at the indexes from the point of data pages, there's no difference at all between a clustered and a nonclustered index. They look the same.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

Jason W
Starting Member

19 Posts

Posted - 2011-07-21 : 17:46:46
Absolutely hilarious!

Here is some additional material on indexes in case you were interested:
http://www.sqloptimizationsschool.com/Pages/Basic%20Concepts/Indexes.aspx
http://www.sqloptimizationsschool.com/Pages/Advanced%20Concepts/Utilizing%20Indexes.aspx
Go to Top of Page
   

- Advertisement -