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.