Truncate table updating statistics oracle


The idea of Incremental Statistics Collection is simply to save time and resources when gathering statistics for partitioned tables in order to update the global stats.

In Oracle Database 12c we added the very important features of: The daily purge of statistics didn’t really work on large synopsis as the default degree of parallelism introduced with Oracle 12c gets derived from the number of blocks on the synopsis table – bigger table means a higher parallel degree for the purge.

Here is an example of using the dbms_stats.gather_schema_stats procedure to gather statistics on the SCOTT schema of a database: This command will generate statistics on all tables in the SCOTT schema.

the operation (see Updating Indexes Automatically), so that they remain available throughout.

After your first truncate, the index needs to be rebuilt - it can't be updated, it's already "broken" and unavailable.

In the next section, we will show you how to generate statistics on tables and indexes in your database.

Starting with the introduction of the dbms_stats package, Oracle provides a simple way for the Oracle professional to collect statistics for the CBO.

Oracle provides a stored procedure (or program) for you to run that will generate the statistics is needs.