Monday, 13 December 2010

How to detriment if your sample statistics is suitable

To detriment if your sample statistics is or not (TD 12) you may need to make a HELP STATISTICS statement on you table or column twice, one with full stats and the other after applying the sampling and see the difference

1- To make a help stats on table level:

HELP STATISTICS "tablename";


2- To make a help stats on Column level:

HELP STATISTICS "tablename" Column "columnname";

Collect Statistics using sample in TD 12

There is a new feature in TD 12 that you can specify the sample percent you need before running collect stat.

You can do it on the,

1- session level:

DIAGNOSTIC "COLLECTSTATS, SAMPLESIZE=20" ON FOR SESSION;

The above statment means that all collect stats starment with "USING SAMLE" keyword in the session will be collected with 20% (You can change it to what is suitable for your tables).

2- Request level:

DIAGNOSTIC "COLLECTSTATS, SAMPLESIZE=20" ON FOR REQUEST;

That's means it will applyed only on the next collect statment that follows the diagnostic statment.