Re: splitting src/bin/scripts/vacuumdb.c

From: Antonin Houska <ah(at)cybertec(dot)at>
To: alvherre(at)kurilemu(dot)de
Cc: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: splitting src/bin/scripts/vacuumdb.c
Date: 2025-09-26 13:46:35
Message-ID: 48811.1758894395@localhost
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Álvaro Herrera <alvherre(at)kurilemu(dot)de> wrote:

> - Two booleans, analyze_in_stages and analyze_only, are really
> determining what "mode" the program runs in -- it's either vacuum, or
> one of those two modes. (Antonin came up with the idea of using
> "modes", but his patch only adds a new REPACK mode on top of the
> existing code without any further changes). I think the code flow is a
> little neater by making this change; consider for instance this change:
>
> - /* If we used SKIP_DATABASE_STATS, mop up with ONLY_DATABASE_STATS */
> - if (vacopts->skip_database_stats && stage == ANALYZE_NO_STAGE &&
> - !vacopts->analyze_only)
> - {
>
> + /* If we used SKIP_DATABASE_STATS, mop up with ONLY_DATABASE_STATS */
> + if (vacopts->mode == MODE_VACUUM && vacopts->skip_database_stats)
> + {
>
> IMO the original is quite unclear.

I agree that redundant information makes things more difficult to think
about. I just wonder if

vacopts->mode != MODE_VACUUM

should be used instead of

(vacopts->mode == MODE_ANALYZE ||
vacopts->mode == MODE_ANALYZE_IN_STAGES)

in some places. Nevertheless, I'm not proposing a global replacement: the
verbose form may be easier to understand, depending on the context.

Other than that, I checked differences between v21, v22 and v23. I've got no
other comments worth posting.

--
Antonin Houska
Web: https://www.cybertec-postgresql.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2025-09-26 13:49:31 Re: Batching in executor
Previous Message Amit Langote 2025-09-26 13:28:33 Batching in executor