| From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
|---|---|
| To: | Kirill Reshke <reshkekirill(at)gmail(dot)com> |
| Cc: | Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, 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-12-05 20:08:06 |
| Message-ID: | aTM7pgNQesAp79Pn@nathan |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Sat, Dec 06, 2025 at 12:56:22AM +0500, Kirill Reshke wrote:
> Hi!
Thanks for reviewing.
>> + <varlistentry>
>> + <term><option>--dry-run</option></term>
>> + <listitem>
>> + <para>
>> + Print, but do not execute, the vacuum and analyze commands that would
>> + have been sent to the server (performs a dry run).
>> + </para>
>> + </listitem>
>> + </varlistentry>
>
> I compared this smgl section to analogous sections of server utilities
> (pg_dump, pg_resetwal, pg_rewind), none of them mentions "dry run" in
> description of what "--dry run" is. So, I think my feeling is that
> this `(performs a dry run).` is unneeded is correct.
I borrowed this from pg_archivecleanup's documentation. But to your point,
there doesn't seem to be a tremendous amount of consistency in the dry-run
options for various utilities.
>> - printf(_("%s: vacuuming database \"%s\"\n"),
>> - progname, PQdb(conn));
>> + printf(_("%s: vacuuming database \"%s\"%s\n"),
>> + progname, PQdb(conn),
>> + vacopts->dry_run ? " (dry-run)" : "");
>
> I am also not sure we need this change. Look:
>
> ```
> reshke(at)yezzey-cbdb-bench:~/pg$ ./bin/bin/vacuumdb --dry-run
> vacuumdb: Executing in dry-run mode.
> vacuumdb: vacuuming database "reshke" (dry-run)
> ```
>
> We have two lines which say the same. Well, maybe there is value in
> this change, if we are vacuuming multiple databases, but given that
> --dry-run produces a lot of
> `VACUUM ... -- not executed` output, I think It will be obvious that
> this vacuumdb run does not modify the system. WDYT?
I guess we could probably remove the top-level "Executing in dry-run mode"
message, provided we say the same thing in the per-database message.
However, the latter can be turned off with --quiet. Maybe we should
consider disallowing --quiet and --dry-run.
Overall, I can't claim to have super principled arguments about where I've
added these dry-run messages. I kind-of just sprinkled them around.
--
nathan
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Kirill Reshke | 2025-12-05 20:10:36 | Re: vacuumdb: add --dry-run |
| Previous Message | Robert Haas | 2025-12-05 19:57:09 | Re: pg_plan_advice |