| From: | Paul Kim <mok03127(at)gmail(dot)com> |
|---|---|
| To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | [PATCH v1] Add vacuum_delay_point() to GiST empty-page deletion pass |
| Date: | 2026-07-21 10:02:37 |
| Message-ID: | 178462815730.66373.14808873588374085998@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
While comparing the vacuum loops of the various index AMs I noticed that
gistvacuum_delete_empty_pages() -- the second pass of a GiST vacuum that
unlinks empty leaf pages -- does not call vacuum_delay_point(), even
though it reads a buffer and issues WAL-logged page deletions for every
internal page it revisits. The other page-scanning loops in
gistvacuum.c, gistvacuumscan() and the recursion in gistvacuumpage(),
both call it.
As a result this phase of a GiST vacuum ignores the cost-based vacuum
delay entirely, and only reacts to query cancellation when a buffer read
happens to perform I/O. On a large GiST index with many emptied leaf
pages this loop can end up walking every internal page of the index.
The attached patch adds a single vacuum_delay_point(false) at the top of
the loop, where no buffer lock is held, matching the sibling idiom. The
function has lacked the call since it was introduced in 7df159a620b.
This is long-standing rather than a recent regression, so I'll leave the
question of back-patching to a committer. Note that on branches before
18 vacuum_delay_point() takes no argument (the bool was added by
e5b0b0ce150), so a back-patch would drop the "false".
Thanks,
Paul Kim
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Add-vacuum_delay_point-to-GiST-empty-page-deletio.patch | text/x-patch | 1.8 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ajin Cherian | 2026-07-21 10:16:13 | Re: [PATCH] Preserve replication origin OIDs in pg_upgrade |
| Previous Message | solai v | 2026-07-21 09:57:46 | Re: Why is the LSN reported for pg_logical_emit_message() different from other decoded operations? |