Re: progress report for ANALYZE - Mailing list pgsql-hackers

From Anthony Nowocien
Subject Re: progress report for ANALYZE
Date
Msg-id CAH5RRoOGf7OcoPF8uObLyMTnHqknbODP7YDP9PmEMYRj2GD7DQ@mail.gmail.com
Whole thread Raw
In response to Re: progress report for ANALYZE  (Julien Rouhaud <rjuju123@gmail.com>)
List pgsql-hackers
Hi,
In monitoring.sgml, "a" is missing in "row for ech backend that is currently running that command[...]".
Anthony


On Tuesday, July 2, 2019, Julien Rouhaud <rjuju123@gmail.com> wrote:
> On Fri, Jun 21, 2019 at 8:52 PM Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
>>
>> Here's a patch that implements progress reporting for ANALYZE.
>
> Patch applies, code and doc and compiles cleanly.  I have few comments:
>
> @@ -512,7 +529,18 @@ do_analyze_rel(Relation onerel, VacuumParams *params,
>     if (numrows > 0)
>     {
>         MemoryContext col_context,
> -                   old_context;
> +                     old_context;
> +       const int   index[] = {
> +           PROGRESS_ANALYZE_PHASE,
> +           PROGRESS_ANALYZE_TOTAL_BLOCKS,
> +           PROGRESS_ANALYZE_BLOCKS_DONE
> +       };
> +       const int64 val[] = {
> +           PROGRESS_ANALYZE_PHASE_ANALYSIS,
> +           0, 0
> +       };
> +
> +       pgstat_progress_update_multi_param(3, index, val);
> [...]
>     }
> +   pgstat_progress_update_param(PROGRESS_ANALYZE_PHASE,
> +                                PROGRESS_ANALYZE_PHASE_COMPLETE);
> +
> If there wasn't any row but multiple blocks were scanned, the
> PROGRESS_ANALYZE_PHASE_COMPLETE will still show the informations about
> the blocks that were scanned.  I'm not sure if we should stay
> consistent here.
>
> diff --git a/src/backend/utils/adt/pgstatfuncs.c
> b/src/backend/utils/adt/pgstatfuncs.c
> index 05240bfd14..98b01e54fa 100644
> --- a/src/backend/utils/adt/pgstatfuncs.c
> +++ b/src/backend/utils/adt/pgstatfuncs.c
> @@ -469,6 +469,8 @@ pg_stat_get_progress_info(PG_FUNCTION_ARGS)
>     /* Translate command name into command type code. */
>     if (pg_strcasecmp(cmd, "VACUUM") == 0)
>         cmdtype = PROGRESS_COMMAND_VACUUM;
> +   if (pg_strcasecmp(cmd, "ANALYZE") == 0)
> +       cmdtype = PROGRESS_COMMAND_ANALYZE;
>     else if (pg_strcasecmp(cmd, "CLUSTER") == 0)
>         cmdtype = PROGRESS_COMMAND_CLUSTER;
>     else if (pg_strcasecmp(cmd, "CREATE INDEX") == 0)
>
> it should be an "else if" here.
>
> Everything else LGTM.
>
>
>

pgsql-hackers by date:

Previous
From: Fabrízio de Royes Mello
Date:
Subject: Re: Introduce MIN/MAX aggregate functions to pg_lsn
Next
From: Paul Ramsey
Date:
Subject: Re: Optimize partial TOAST decompression