Because a cost-based optimizer needs accurate statistics, run ANALYZE on PostgreSQL partitioned tables to gather them, since auto-analyze only processes partitions. https://dev.to/aws-heroes/postgresql-global-statistics-on-partitionned-table-require-a-manual-analyze-473h
PostgreSQL global statistics on partitionned table require a manual ANALYZE

PostgreSQL auto-analyze collects statistics on tables with rows. For partitioned tables, it excludes...

DEV Community