Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
T-SQL (SS2K8)
»
How often are indexes updated?
How often are indexes updated?
Rate Topic
Display Mode
Topic Options
Author
Message
Golfer22
Golfer22
Posted Tuesday, December 25, 2012 7:28 PM
SSC Journeyman
Group: General Forum Members
Last Login: Saturday, February 02, 2013 11:13 PM
Points: 82,
Visits: 76
When an index is created with STATISTICS_NORECOMPUTE = OFF, how frequently is the index updated? Is it updated every time the table has new rows created on it?
Post #1400122
dwain.c
dwain.c
Posted Tuesday, December 25, 2012 11:29 PM
SSCrazy
Group: General Forum Members
Last Login: Today @ 6:03 AM
Points: 2,345,
Visits: 3,191
I'm pretty sure the index always gets updated when rows are INSERTed, UPDATEd or DELETEd regardless of the setting, because it must or the database would lose track of rows in the table. What is not updated is statistics on any queries that use the table.
If you add the INDEX with STATISTICS_NORECOMPUTE = ON, then existing statistics would be retained for all impacted queries, impairing the optimizer's ability to utilize the new INDEX to improve a queries performance. With it OFF, then the statistics would be updated when the INDEX is added.
Someone else may be better equipped to explain this than me though.
While they're at it, why did MS have to use STATISTICS_NORECOMPUTE instead of STATISTICS_RECOMPUTE? The double negative drives me batty!
No loops! No CURSORs! No RBAR! Hoo-uh!
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
Need to UNPIVOT? Why not CROSS APPLY VALUES instead?
Since random numbers are too important to be left to chance, let's generate some!
Are you too recursively challenged?
Splitting strings based on patterns can be fast!
Post #1400150
GilaMonster
GilaMonster
Posted Wednesday, December 26, 2012 1:10 PM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 3:28 PM
Points: 37,732,
Visits: 29,996
Golfer22 (12/25/2012)
When an index is created with STATISTICS_NORECOMPUTE = OFF, how frequently is the index updated? Is it updated every time the table has new rows created on it?
Within the same operation as the base table. SQL's indexes are never out of sync with the table.
STATISTICS_NORECOMPUTE has nothing to do with the index itself. If it's set on it just means that that index's statistics object is not automatically updated.
Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild
: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter
We stand on the bridge and no one may pass
Post #1400354
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.