[PATCH v1] Add pg_stat_progress overview view

Поиск
Список
Период
Сортировка
Искать

[PATCH v1] Add pg_stat_progress overview view

От:
Josef Šimánek <josef.simanek@gmail.com>
Дата:
Вложения:
Hi,

finding active progress reports currently requires querying each
pg_stat_progress_* view separately.

This patch adds pg_stat_progress with three columns: pid, command, and
progress_view, pointing to the detailed view for each operation. It
reuses the existing infrastructure without backend changes. IMHO,
these are the minimal common fields. I also considered datid and
datname, but some tracked operations, such as base backups, cover the
whole cluster.

Documentation and tests are included. Build, regression, isolation,
and new TAP tests passed locally.

I'd appreciate feedback on the usefulness and proposed columns. My
longer-term aim is to make cluster operations easier to discover and
monitor, and to extend progress reporting to more commands.

Regards,
Josef

Re: [PATCH v1] Add pg_stat_progress overview view

От:
yuansong <yyuansong@126.com>
Дата:
Hi Josef,

I took a look at v1. Overall this looks like a good, low-risk patch -- a
small SQL-only view that reuses pg_stat_get_progress_info() with no backend
changes. I checked it against current master and found no functional
problems. A few comments:

1. The patch bumps CATALOG_VERSION_NO from 202611021 to 202611071, but it is
   based on an older master (current master is already at 202611121), so the
   hunk will conflict on rebase. Per the usual practice, catversion bumps
   are handled by the committer at commit time rather than in submitted
   patches -- repeatedly bumping it just creates avoidable rebases. Could
   you please rebase and drop the catversion change? If you'd like to flag
   it, a note in the commit message that a catversion bump is needed is the
   recommended way to do so.

2. (Optional nit) The VALUES list ties the displayed command names to the
   strings accepted by pg_stat_get_progress_info(). I verified all seven
   match the pg_strcasecmp() mapping in pgstatfuncs.c, and that omitting
   CLUSTER is correct since it is only a compatibility view over REPACK.
   This mirrors the existing per-command progress views, so it's not a new
   pattern; a short comment noting the list must stay in sync would still
   help whoever adds the next command type, but I don't consider it blocking.

3. CROSS JOIN LATERAL calls pg_stat_get_progress_info() once per command
   (7 times), each call walking all backends and taking a separate stats
   snapshot. This is the same trade-off the existing progress views make,
   so I'm not asking for a code change -- but as the wiki asks for a note on
   performance impact, it may be worth mentioning in the cover email.

4. In the TAP test, progress_gate() is declared IMMUTABLE while taking an
   advisory lock. I understand it has to be IMMUTABLE to be usable in the
   expression index that drives the test -- worth a comment to that effect
   so nobody "fixes" it later.

Nits: consider noting in the docs how to get the database dimension (join
pg_stat_activity on pid), since datname was deliberately left out.

Tests and docs look thorough. Aside from the rebase in (1), this looks
ready for committer from my side.

Best regards,
Yuansong

Re: [PATCH v1] Add pg_stat_progress overview view

От:
Sami Imseih <samimseih.pg@gmail.com>
Дата:
Hi Josef,

> finding active progress reports currently requires querying each
> pg_stat_progress_* view separately.

Thanks for the patch. I looked through it, but I'm having trouble
seeing the use case. Since the view only exposes pid, command, and
the name of the detailed view, a monitoring tool would still need to
query that specific view to get anything actionable.

Could you share some real-world scenarios where this would be useful?

--
Sami


FAQ