Quantcast
Channel: Teradata Developer Exchange - Blog activity for carrie's blog
Viewing all articles
Browse latest Browse all 1058

Statistics Threshold Functionality 101 - comment by carrie

$
0
0

You are correct that usecount logging must be enabled for the database involved before skipping will be considered.  You don't have to specify USING SYSTEM THRESHOLD on the collect stats statement for skipping to be considered.  If the default SysChangeThresholdOption is on (which it is by default), and usecount logging is happening to that database, then skipping will be considered without specifying it on the collect stats statement. 
 
In the case of your question, the default system threshold will be applied first, even if SYSTEM THRESHOLD is not specified on the collect statement (for the reasons stated above). If the optimizer determines to skip recollections, then no sampling will be considered.  If the optimizer determines not to skip, then whichever of those two SAMPLE options is on the statement will be applied.   Only a single SAMPLE option is allowed per statement.
 
You can see whether a particular statement is eligible for either threshold or sampling by doing a SHOW STATISTICS COLUMN (col-name) ON table-name;  Look for any comment lines (lines that begin with “—“) that refer to either threshold or sampling, that is what will tell you what to expect.  For example:
 
Assume the Global threshold default is set to SYSTEM THRESHOLD
 
SHOW STATISTICS COLUMN (o_orderkey) ON ABC.OrderTbl0;
‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
COLLECT STATISTICS
USING SAMPLE 10.00 PERCENT
‐‐ default SYSTEM THRESHOLD PERCENT  
COLUMN ( O_ORDERKEY )
ON TPCD.OrderTbl0 ;
 
Thanks, -Carrie


Viewing all articles
Browse latest Browse all 1058

Trending Articles



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