SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Updating Statistics


Updating Statistics

Author
Message
Dana Medley
Dana Medley
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3148 Visits: 1707
sestell1 (3/14/2014)
OCTom (3/14/2014)
Koen Verbeeck (3/14/2014)
Richard Warr (3/14/2014)
Stewart "Arturius" Campbell (3/14/2014)
Interesting question, thanks Steve.
Misread the question, thought it meant the highest level that a single command can be used...

ah well...


Same here Doze


+1
Didn't get the intent of the question, so I choose database level.


Yup. Same here. Ermm



Arrrgggh.... me too. Crazy
I have to stop answering these first thing in the morning. Ermm

Almost happened to me and then I second guessed myself. Thanks for the question Steve.



Everything is awesome!
hakan.winther
hakan.winther
Hall of Fame
Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)

Group: General Forum Members
Points: 3333 Visits: 612
Well, it depends:
sp_updatestats updates only the statistics that require updating based on the rowmodctr information in the sys.sysindexes catalog view, thus avoiding unnecessary updates of statistics on unchanged rows.

That is, if the rowmodctr is too low, the statistics is not updated.

Anyway, if you experience problem with statistics, you should try to add the traceflags in SQL Server 2008R2 (sp2) or later:
2371, Changes the threashold for auto update stats for large tables
2389, Changes the behaviour of known incrementing columns like IDENTITY
2390, Changes the behaviour of columns with incrementing values like a datetime column with incrementing values.

(Or wait 'til SQL server 2014)

/Håkan Winther
MCITPBigGrinatabase Developer 2008
MCTS: SQL Server 2008, Implementation and Maintenance
MCSE: Data Platform
Tom Thomson
Tom Thomson
One Orange Chip
One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)

Group: General Forum Members
Points: 26219 Visits: 12506
Nice question, I had forgotten that sp_updatestats existed so I got it wrong. Maybe now I'll remember ;-)

Tom

pchirags
pchirags
SSCrazy
SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)

Group: General Forum Members
Points: 2717 Visits: 616
nice explanation steve.
thanks.
Hany Helmy
Hany Helmy
SSCarpal Tunnel
SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)

Group: General Forum Members
Points: 4559 Visits: 1117
sestell1 (3/14/2014)
OCTom (3/14/2014)
Koen Verbeeck (3/14/2014)
Richard Warr (3/14/2014)
Stewart "Arturius" Campbell (3/14/2014)
Interesting question, thanks Steve.
Misread the question, thought it meant the highest level that a single command can be used...

ah well...


Same here Doze


+1
Didn't get the intent of the question, so I choose database level.


Yup. Same here. Ermm



Arrrgggh.... me too. Crazy
I have to stop answering these first thing in the morning. Ermm

- 1 w00t
Hany Helmy
Hany Helmy
SSCarpal Tunnel
SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)

Group: General Forum Members
Points: 4559 Visits: 1117
TomThomson (3/14/2014)
Nice question, I had forgotten that sp_updatestats existed so I got it wrong. Maybe now I'll remember ;-)

How did I miss that?! the database level.Hehe
ClaireM
ClaireM
Valued Member
Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)

Group: General Forum Members
Points: 63 Visits: 253
Oh dear. Would have gone for the correct answer if I hadn't paused and asked myself what this question really wanted. My interpretation was that you can't update statistics on multiple tables using just one statement which left only the database level.
I'll avoid any questions in the future that make me wonder what they are asking for.
julienchappel 38298
julienchappel 38298
SSC-Addicted
SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)

Group: General Forum Members
Points: 419 Visits: 244
The database leve and sp_udatestats is the correct answer. Please read carefully your own question.
kapfundestanley
kapfundestanley
SSCrazy
SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)

Group: General Forum Members
Points: 2037 Visits: 1317
Easy one for me.thanks

“When I hear somebody sigh, ‘Life is hard,’ I am always tempted to ask, ‘Compared to what?’” - Sydney Harris
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search