views:

549

answers:

1
+1  Q: 

Clustered Indexing

Does Clustered index needs one extra table to sort/keep the rows data? When it does the sorting , on each Insert or delete statement or when ? How clustered index store data and how it is different from Non-clustered one.

+3  A: 
  • The data is the clustered index
  • Index sort is on creation/rebuild only
  • Inserts may create page splits and pointers
  • Deletes leave gaps
  • Gaps are removed by index rebuild
  • Clustered = data sorted as per definition
  • Non-clustered = points to clustered index and has it's own sort

Starter article on Simple-Talk

A more in depth article on Simple-Talk

Edit: Another Simple-Talk article on index maintenance

gbn
Then when index rebuild is done?Is it manual or automatically done by Database server?
You need to trigger index rebuild - it's never done automatically
marc_s
Thanks for the Links.
+1 - excellent resources - couldn't have said it better myself :-)
marc_s
Thanks. Added link to index maintenance.
gbn
How to rebuild the index manually in Sql Server. Thanks in advance. :)
In SQL Mgmt Studio, open the Object EXplorer, find the database and table you're interested in, open the table node, open the "Indexes" node, pick the right index, right-click - in the context menu, you have two option "Reorganize" and "Rebuild"
marc_s
If you want to semi-automate the process, check out Michelle Ufford's excellent Index Defrag Script here: http://sqlfool.com/2009/06/index-defrag-script-v30/
marc_s