Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3353

Re: How to clean missing statistics information from system tables.

$
0
0

Missing statistics are stored in the "sysstatistics" table for each database.  Look for "formatid" of 110.

 

For example:

select  user_name(so.uid),so.name,ss.colidarray

 

                from    sysobjects so INNER JOIN  sysstatistics ss

 

ON  so.id = ss.id

 

                 where   so.type                 = "U"

 

    and so.sysstat2 & 1024 != 1024

 

     and         so.sysstat2 & 2048      != 2048      /* regular tables */

 

     and     ss.formatid             = 110           /* missing statistics formatid */

 

 

 

One could write a "delete" statement based on the logic above and  create a stored proc (while "allow system table updates" is set on) that could delete these rows from sysstatistics.  The proc could accept a table name (and even a column name), or such that would control doing this for certain tables/columns, or all tables/columns etc.


Viewing all articles
Browse latest Browse all 3353

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>