|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Today @ 6:05 AM
Points: 86,
Visits: 981
|
|
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??
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Today @ 11:52 AM
Points: 3,578,
Visits: 5,118
|
|
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 at GMail
|
|
|
|