On 2017/02/19 18:53, Robert Haas wrote:
> On Fri, Feb 17, 2017 at 1:12 PM, Amit Langote wrote:
>> Do you mean that if database-wide analyze is to be run, we should also
>> exclude those RELKIND_RELATION relations that are partitions?
>>
>> So the only way to update a partition's statistics is to directly specify
>> it in the command or by autovacuum.
>
> I think if you type:
>
> ANALYZE;
>
> ...that should process all partitioned tables and all tables that are
> not themselves partitions.
OK.
> If you type:
>
> ANALYZE name;
>
> ...that should ANALYZE that relation, whatever it is. If it's a
> partitioned table, it should recurse.
To be clear, by "recurse" I assume you mean to perform ANALYZE on
individual partitions, not just collect the inheritance statistics. So
ANALYZE partitioned_table would both a) collect the inheritance statistics
for the specified table and other partitioned tables in the hierarchy, b)
ANALYZE every leaf partitions updating their statistics in pg_class.
While working on this, I noticed that autovacuum.c does not collect
RELKIND_PARTITIONED_TABLE relations, which I think is not right. It
should match what get_rel_oids() does, which in the database-wide
VACUUM/ANALYZE case collects them.
Attached updated patches:
Updated 0001 addresses the following comments:
- should recurse when vacuum/analyze is performed on a partitioned table
- database-wide vacuum should ignore partitioned tables
- database-wide analyze should ignore partitions; only the inheritance
statistics of the partitioned tables must be collected in this case
Thanks,
Amit
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers