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
gbn
2009-07-24 06:29:46
Then when index rebuild is done?Is it manual or automatically done by Database server?
2009-07-24 06:35:18
You need to trigger index rebuild - it's never done automatically
marc_s
2009-07-24 06:35:52
Thanks for the Links.
2009-07-24 06:35:54
+1 - excellent resources - couldn't have said it better myself :-)
marc_s
2009-07-24 06:36:30
Thanks. Added link to index maintenance.
gbn
2009-07-24 06:45:15
How to rebuild the index manually in Sql Server. Thanks in advance. :)
2009-07-24 07:23:36
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
2009-07-24 08:13:25
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
2009-07-24 08:14:09