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
 Updating of indices in a table

Author  Topic 

Lionheart
Starting Member

41 Posts

Posted - 2011-01-07 : 09:22:54
I have created an index within a table. If I add columns to the table or update the information in the current cells is the index automatically updated? If not, how can I set to update automatically?

Thx

LH

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2011-01-07 : 09:55:38
Indexes are automatically update when content is changed. New columns are not automatically added to the index.
However, the underlying statistics may not be updated every time.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

Lionheart
Starting Member

41 Posts

Posted - 2011-01-07 : 11:30:41
Sorry, I meant if new rows were added do they automatically get indexed?

LH
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2011-01-07 : 11:32:10
Yes.
Go to Top of Page

Lionheart
Starting Member

41 Posts

Posted - 2011-01-07 : 12:14:52
Thx
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2011-01-07 : 12:53:35
You do need to update the statistics periodically though (otherwise your queries may not operate in an optimally efficient manner) and you should rebuild the indexes periodically too (that tidies them up and rearranges them into optimal structure).

Depending on how you choose to rebuild the indexes that may also update the statistics as a side-benefit - saving the need for doing that job separately.

The maintenance plans include tools to schedule such "house-keeping" tasks during suitable quiet times in the day / week.
Go to Top of Page
   

- Advertisement -