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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Question about INDEX

Author  Topic 

Mazdak
Yak Posting Veteran

63 Posts

Posted - 2002-10-31 : 05:34:25
I'm reading SAMS,SQLServer 2000 book now and I'm on INDEX now.I don't get it properly,would somebody tell me if this is correct about INDEX or not:

When I create an INDEX for a column in a table,this table maybe has some data.Is that true that INDEX work proparly for data that exist in table,not for the ones that will be added in the furure or updated in the future.So I need to run UPDATE STATICS command regulary for that table?

ashok
Yak Posting Veteran

57 Posts

Posted - 2002-10-31 : 05:43:01
quote:

When I create an INDEX for a column in a table,this table maybe has some data.Is that true that INDEX work proparly for data that exist in table,not for the ones that will be added in the furure or updated in the future.So I need to run UPDATE STATICS command regulary for that table?


No, SQL server automatically updates statistics periodically.
THough, you can manually update it immediately using UPDATE STATISTICS or if you have disabled the SQL server automatic stats update.


-ashok
"Bad dancing does not break an engagement."

Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-10-31 : 06:58:18
Pause ... statistics and indexes are not the same thing.

SQL Server uses statistical information regarding the distribution of values in the indexed column(s) to allow the query processor to determin the optimal strategy for evaluating a query. And if you've read the book, you quickly see that this is a different thing than an index.

But the answer remains the same. When you create and index, data is organized on the phyiscal disk. When you insert data to that table, the indexes will be re-sorted and the new data will be assigned the correct leaf of the b-tree.

The UPDATE STATISTICS command will recalculate the distribution data. If you use sp_dboption to enable the 'auto create statistics' option, SQL will periodically automatically do the recalculation for you.

Jay White
{0}
Go to Top of Page

Mazdak
Yak Posting Veteran

63 Posts

Posted - 2002-10-31 : 07:24:23
Thank you both.I got the point now.

Go to Top of Page
   

- Advertisement -