3

I'm trying to grasp the following sentence from https://www.postgresql.org/docs/9.5/static/sql-analyze.html

The autovacuum daemon, however, will only consider inserts or updates on the parent table itself when deciding whether to trigger an automatic analyze for that table. If that table is rarely inserted into or updated, the inheritance statistics will not be up to date unless you run ANALYZE manually.

Since partitioning is usually implemented through inheritance, initially, I thought this sentence implies that, being the master table empty in a partitioned table, autovacuum would never trigger an automatic ANALYZE on the whole partitioned table (including all children) leaving the planner with no statistics at all for the partitions.

On the other hand, "that table" seems to refer only to the parent table (master). If this second reading is correct, autovacuum does trigger ANALYZE automatically on the children tables and, obviously, ignores the parent, empty table. There would be no need to run ANALYZE manually in this case.

Which of the two interpretations is the right one?

1 Answer 1

0

Old question, but there is a long thread debating how to clean up the docs here.

In a nutshell, the issue is around the "parent table" only. From the thread:

read "partitioned table" to mean "only the thing with relkind set to 'p'" and not "both the partitioned table and its partitions."

The docs say (emphasis theirs):

The table that is divided is referred to as a partitioned table... The partitioned table itself is a “virtual” table having no storage of its own. Instead, the storage belongs to partitions, which are otherwise-ordinary tables associated with the partitioned table.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.