Updated on 2024-06-07 GMT+08:00

Collecting Statistics on Partitioned Tables

For partitioned tables, you can collect partition-level statistics, which can be queried in the pg_partition and pg_statistic system catalogs and in the pg_stats and pg_ext_stats views. Partition-level statistics apply to the scenario where the scanning range of a partitioned table is pruned to a single partition after static pruning is performed on the partitioned table. Partition-level statistics include the number of pages and tuples, single-column statistics, multi-column statistics, and expression index statistics.

You can collect statistics on partitioned tables in either of the following ways:

  • Collect statistics in cascading mode.
  • Collecting statistics on a specified partition