[YAHT] Yet Another How To come on trace of bad SQL performance
24. Juni 2009 von Jürgen
Maybe the statistics are outdated?! – wich might cause the sql server making use of expensive query plans.
But how can we proof that?
We can exececute one or more of the following statements to ask the sql server for…
SELECT 'Object Name' = o.name, 'Index Name' = i.name, 'Statistics Date' = STATS_DATE(o.id, i.indid)
FROM sysobjects o
JOIN sysindexes i ON o.name = 'CHLG_CUSTOMER' AND o.id = i.id;
DBCC SHOW_STATISTICS ('CHLG_CUSTOMER', 'Ind_87252');
exec sp_autostats @tblname = 'CHLG_CUSTOMER'
Some of that statements can also be used to toogle the auto statistics functionality of sql server on or off.
You also might need to change the correct syntax to apply with the sys.objects resp. sys.indexes system views of sql server 2005 and higher.
hi, ich bin Jürgen aká zero und auf meinem blog findest du Infos zu Themen die mich interessieren (allein das kann schon ziemlich umfangreich sein) und Sachen die ich mir hier notiere damit ich sie nicht vergesse.
That’s cool!
I can say the script snippets are working on MS SQL Server 2005 SP2
Roland