Re: vacuumdb: add --dry-run

Corey Huinker <corey.huinker@gmail.com>

From: Corey Huinker <corey.huinker@gmail.com>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Chao Li <li.evan.chao@gmail.com>, pgsql-hackers@postgresql.org
Date: 2025-11-20T00:54:06Z
Lists: pgsql-hackers

Attachments

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

> On Wed, Nov 19, 2025 at 5:44 PM Nathan Bossart <nathandbossart@gmail.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.