Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Update Statistics Expand / Collapse
Posted Sunday, September 9, 2012 12:39 AM


Group: General Forum Members
Last Login: Friday, November 11, 2016 10:14 PM
Points: 127, Visits: 1,258
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??
Post #1356451
Posted Monday, September 10, 2012 8:45 AM



Group: General Forum Members
Last Login: Today @ 10:32 AM
Points: 5,645, Visits: 8,169
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.


Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru at GMail
Post #1356791
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse