Recurring Conversations – Incremental Statis ...
Doug's Oracle Blog
Display comments as (Linear | Threaded)
When they time this they find that 3 takes just as long as 2 and, in fact, it takes a little longer! This is useless? What is the point of this new feature if it doesn't speed up the gathering of Global stats?
First I want to look at what we asked Oracle to do in steps 2) and 3) above.
2) Visited all of the partitions of the table to gather information and then update the Global stats on the table.
3) Visited all of the partitions of the table to gather information, update the Global stats on the table and generate synopses for future use.
On that basis, why *wouldn't* option 3 take longer than option 2? They do more or less the same thing but 3) has to do a little additional work.
So if it isn't quicker to gather Global Stats using Incremental Global Statistics, why would you use it?
The benefits don't come from the initial gathering of Global Stats but when you gather stats on new Partitions and *don't* need to gather Global Stats any more. Instead Oracle uses those handy synopses to update them which is a much quicker operation! The Real World cycle of use then looks like this.
1) Delete all of your existing table stats.
2) Set INCREMENTAL to TRUE.
3) Gather table stats using GRANULARITY =>'GLOBAL AND PARTITION' without supplying a PARTNAME. This will re-gather all of your Global and Partition stats across the table and build the initial synopses. Note that at this stage you have achieved no reductions in stats collection times.
4) As you load partitions with new data or the data changes and you need to update your stats, use one of a number of options but the one I tend to use is to gather the stats on each specific partition using GRANULARITY=>' GLOBAL AND PARTITION' with PARTNAME set to the name of the partition we've just loaded. Oracle will now gather Partition stats on just the one Partition and update the Global Stats and the synopses based on the new data that's been introduced.
Bingo – you've just maintained accurate Global Stats without having to trawl through the entire table again!
That's the point.
It's about *not* gathering Global Stats but also not letting them drift hopelessly out of whack with the contents of the table. Measuring the performance of a full Global Stats gathering operation doesn't illustrate the performance benefits.
Part 1 - Default options - GLOBAL AND PARTITION
Part 2 - Estimated Global Stats
Part 3 - Stats Aggregation Problems I
Part 4 - Stats Aggregation Problems II
Part 5 - Minimal Stats Aggregation
Part 6a - COPY_TABLE_STATS - Intro
Part 6b - COPY_TABLE_STATS - Mistakes
Part 6c - COPY_TABLE_STATS - Bugs and Patches
Part 6d - COPY_TABLE_STATS - A Light-bulb Moment
Part 6e - COPY_TABLE_STATS - Bug 10268597
A couple of posts about Incremental Stats confusion