Running an analyze on the partition directly can sometimes trigger an internal analyze on the root table which locks the root table in a "ShareUpdateExclusiveLock" lock. This can cause locking contention on other queries running on this table and slow down performance.
gpadmin=# analyze verbose p1_1_prt_1; INFO: analyzing "public.p1_1_prt_1" INFO: Executing SQL: select pg_catalog.gp_acquire_sample_rows(24579, 10000, 'f'); INFO: analyzing "public.p1" inheritance tree
ANALYZE in a maintenance scenario where scripts are running an analyze on partitions separately can lead to excessive locking on the root table and thus lead to locking contention and blocked queries.
One way to disable the analyze on the root table "INFO: analyzing "public.p1" inheritance tree" is to set the following GUC to off:
set optimizer_analyze_enable_merge_of_leaf_stats = off;
Once analyze on all the partitions are completed, you can then run a separate analyze on the root using:
analyze rootpartition public.p1;
When using ORCA (optimizer=on), it is important to run an analyze on the root since ORCA uses root stats when generating explain plans.
Product Version: 6.x