show_missing_stats shows details of useful statistics missing from SARG / Join columns.
It is important to note there are several situations where show_missing_stats will not print.
If you run a “stored-procedure” and there is a current plan in the master..sysqueryplans”, the “show_missing_statistics” will not print anything. You can do one of 2 things.
Run the stored-procedure with [...]
This query turns out to be helpful in determining which statistics are available for a certain user table (remove the double dash from the commented-out code line and add the table name) or for all tables.
SELECT object_name(s.id) tablename,
c.name column_name,
convert(int,c4)actual_steps,
convert(int,c5)requested_steps,
moddate last_updated
FROM sysstatistics s,syscolumns c
WHERE formatid=100
– AND s.id = object_id(”TABLE_NAME”)
AND s.id=c.id
AND s.id >100
AND s.c4 != null
AND s.c5 [...]