Autovacuum (analyze) on partitioned tables for ATTACH/DETACH/DROP commands

From: yuzuko <yuzukohosoya(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Autovacuum (analyze) on partitioned tables for ATTACH/DETACH/DROP commands
Date: 2021-06-21 08:21:25
Message-ID: CAKkQ50_H0k_Y9WjU2n=n11YtSfnLJAHMXef2uorQBFTcCJif_A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

While discussing auto analyze on partitioned tables, we recognized that
auto analyze should run on partitioned tables when ATTACH, DETACH
and DROP commands are executed [1]. Partitioned tables are checked
whether they need auto analyze according to their
changes_since_analyze (total number of inserts/updates/deletes on
partitions), but above DDL operations are not counted for now.

To support ATTACH, DETACH and DROP commands, I proposed
the idea as follows:
* I made new configuration parameters,
autovacuum_analyze_attach_partition,
autovacuum_analyze_detach_partition and
autovacuum_analyze_drop_partition to enable/disable this feature.
* When a partition is attached/detached/dropped, pgstat_report_anl_ancestors()
is called and checks the above configurations. If ture, the number of
livetuples of the partition is counted in its ancestor's changed tuples
in pgstat_recv_anl_ancestors.

Attach the v1 patch. What do you think?

[1] https://www.postgresql.org/message-id/ce5c3f04-fc17-7139-fffc-037f2c981bec%40enterprisedb.com
--
Best regards,
Yuzuko Hosoya
NTT Open Source Software Center

Attachment Content-Type Size
v1_autovacuum_for_attach_detach_drop_commands.patch application/octet-stream 20.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-06-21 08:22:46 Re: Fix for segfault in logical replication on master
Previous Message Japin Li 2021-06-21 08:00:16 Re: Fix for segfault in logical replication on master