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


Update Statistics


Update Statistics

Author
Message
mah_j
mah_j
Say Hey Kid
Say Hey Kid (701 reputation)Say Hey Kid (701 reputation)Say Hey Kid (701 reputation)Say Hey Kid (701 reputation)Say Hey Kid (701 reputation)Say Hey Kid (701 reputation)Say Hey Kid (701 reputation)Say Hey Kid (701 reputation)

Group: General Forum Members
Points: 701 Visits: 1262
Hi every body

Updating statistics causes queries to recompile.
first time that i run a query with a parameter,the query optimizer make a plan according to that parameter and the next time it doesnt make another plan for another parameter but it uses the first plan which may be not optimal for that parameter and it causes reduction in performance.(parameter sniffing)

when i run update statistics it takes 30 minutes to compelete.
what happens in this 30 minutes?i mean if i run a query during the updating,it recompiles or the query optimizer use the first plan until it finishes updating then after that it start recompliling?
during this 30 minutes which plan is used??
TheSQLGuru
TheSQLGuru
SSC-Dedicated
SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)

Group: General Forum Members
Points: 31633 Visits: 8671
My understanding is that stats are not "swapped out" until they are complete - at which point stuff is marked as recompile. So your existing plan will keep getting reused in the 30 mins it takes to complete stats update on the table/index/stat that affects the plan.

Best,
Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru on googles mail service
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