Re: vacuumdb: add --dry-run

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: vacuumdb: add --dry-run
Date: 2025-11-20 00:54:06
Message-ID: CADkLM=d+XROe3JgM5gZno0JGEgxnDDCYsEHgQjg5x7d0OQp5vA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Nov 19, 2025 at 6:55 PM Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
wrote:

> On Wed, Nov 19, 2025 at 5:44 PM Nathan Bossart <nathandbossart(at)gmail(dot)com>
> wrote:
>
>> On Wed, Nov 19, 2025 at 05:23:48PM -0500, Corey Huinker wrote:
>> > Now with zero hangs and some test cases. I didn't create a function
>> (yet)
>> > as it seemed trivial.
>>
>> I still think it could be worth moving the dry-run code into
>> run_vacuum_command() (which might entail moving the calls to
>> ParallelSlotSetHandler() there, too). We can probably piggy-back on the
>> "if (echo)" branch in that function.
>>
>
> We _could_ get away with moving ParallelSlotGetIdle() in there too. The
> only catch would be that we'd have to refactor prepare_vacuum_command() to
> take a serverVersionNumber parameter instead of the whole connection.
> Thoughts?
>
>
>>
>> Also, we can probably skip the executeCommand() calls for
>> --analyze-in-stages.
>>
>
> +1
>

Here's a shopping list of incremental changes. I'm happy with whatever
makes the most sense to you.

Attachment Content-Type Size
v3-0001-Add-dry-run-to-vacuumdb.patch text/x-patch 6.5 KB
v3-0002-switch-from-passing-conn-to-passing-slot.patch text/x-patch 2.1 KB
v3-0003-move-dry_run-test-inside-run_vacuum_command.patch text/x-patch 3.1 KB
v3-0004-switch-prepare-from-conn-to-serverVersion.patch text/x-patch 2.4 KB
v3-0005-handle-ParallelSlotGetIdle-inside-run_vacuum_comm.patch text/x-patch 3.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Yuefei Shi 2025-11-20 00:58:30 Re: Use strtoi64() in pgbench, replacing its open-coded implementation
Previous Message Shinya Kato 2025-11-20 00:34:49 Re: Add mode column to pg_stat_progress_vacuum