On Tue, 20 Aug 2024 at 23:25, Ilia Evdokimov <ilya.evdoki...@tantorlabs.com> wrote: > Your proposal is indeed interesting, but I have a question: can't your issue > be resolved by properly configuring autovacuum instead of developing a new > feature for ANALYZE?
Basically, no. There's a "tip" in [1] which provides information on the limitation, namely: "The autovacuum daemon does not issue ANALYZE commands for partitioned tables. Inheritance parents will only be analyzed if the parent itself is changed - changes to child tables do not trigger autoanalyze on the parent table. If your queries require statistics on parent tables for proper planning, it is necessary to periodically run a manual ANALYZE on those tables to keep the statistics up to date." There is also some discussion about removing the limitation in [2]. While I agree that it would be nice to have autovacuum handle this, it's not clear how exactly it would work. Additionally, if we had that, it would still be useful if the ANALYZE command could be instructed to just gather statistics for the partitioned table only. David [1] https://www.postgresql.org/docs/devel/routine-vacuuming.html#VACUUM-FOR-STATISTICS [2] https://www.postgresql.org/message-id/flat/CAKkQ508_PwVgwJyBY%3D0Lmkz90j8CmWNPUxgHvCUwGhMrouz6UA%40mail.gmail.com