回复 2# ppjava2009 看这篇文章,http://www.ibm.com/developerwork ... rticle/dm-0706tang/ Automatic table maintenance in DB2, Part 1: Automatic statistics collection in DB2 for Linux, UNIX, and Windows里面有个图,“Figure 12. Flowc...
显示全部回复 2# ppjava2009 看这篇文章,
http://www.ibm.com/developerwork ... rticle/dm-0706tang/ Automatic table maintenance in DB2, Part 1: Automatic statistics collection in DB2 for Linux, UNIX, and Windows
里面有个图,“Figure 12. Flowchart on determining which tables to collect statistics on DB2 V8.2”,可以知道DB2是通过看UDI conter来判断是否需要runstats的。
这个图是基于v8.2的,目前基本上应该也是这个设计。
The easiest way to understand automatic statistics collection is to think of it as a series of tests applied sequentially to each table. A test is performed only if the results of all previous tests were positive.
Check if the table is due for evaluation. No further action performed if the table is not due for evaluation. An internal table is used to track if tables are due for evaluation.
Check if the table has been accessed by the current workload.
Check if table has statistics. If statistics hare never been collected for this table, issue RUNSTATS on the table. No further checks performed.
Check whether UDI counter is greater than 10% of the rows. If not, no action on the table.
Check whether UDI counter is greater than 50% of the rows, issue RUNSTATS on the table if UDI counter is greater than 50% of the rows.
Issue RUNSTATS if the table is small.
if table is large (more than 4000 pages), sample the table to decide whether or not to perform RUNSTATS.
收起