| From: | Guillaume Lelarge <guillaume(dot)lelarge(at)dalibo(dot)com> |
|---|---|
| To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: [PATCH v1 0/7] Wait event timing and tracing instrumentation |
| Date: | 2026-07-11 20:01:11 |
| Message-ID: | 2b206198-19d0-4fb1-adca-046e38e1a92a@dalibo.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
On 11/07/2026 20:42, Dmitry Fomin wrote:
> Hi hackers,
>
> Hi hackers,
>
> v3 is v2 rebased over current master (5f14f82280d); cfbot flagged the
> set as needing a rebase after typedefs.list drifted. No code changes.
>
Just a quick note to say I'm very interested in these patches. I've
tried them and I'm quite enthusiastic with it. For example, it's nice to
see wait events wrt the checkpointer:
select wait_event_type, wait_event, calls, total_time_ms
from pg_stat_wait_event_timing
where pid=984861
order by total_time_ms desc;
┌─────────────────┬──────────────────────┬───────┬───────────────┐
│ wait_event_type │ wait_event │ calls │ total_time_ms │
├─────────────────┼──────────────────────┼───────┼───────────────┤
│ Activity │ CheckpointerMain │ 3 │ 300109.767515 │
│ Timeout │ CheckpointWriteDelay │ 1056 │ 105928.938476 │
│ IO │ DataFileWrite │ 1751 │ 61.356984 │
│ IO │ DataFileFlush │ 77 │ 7.395531 │
│ IO │ SlruWrite │ 3 │ 0.095615 │
└─────────────────┴──────────────────────┴───────┴───────────────┘
(5 rows)
That's definitely something I was waiting for.
Anyway, it was just a quick look. The patches apply to HEAD, they
compile, and it was easy to do some quick tests. I'll try to find some
time to work more on this, but I'd be very interested to see this
landing in v20.
Kudos for the great work, Dmitry!
Regards.
> Regards,
> Dmitry Fomin
>
> Dmitry Fomin (7):
> wait_event_timing: add --enable-wait-event-timing flag and
> wait_event_capture GUC
> wait_event_timing: record per-backend wait event statistics (stats
> level)
> wait_event_timing: expose overflow counters and add reset functions
> ci: build one task with --enable-wait-event-timing
> wait_event_timing: allocate the per-backend array lazily in DSA
> wait_event_timing: add trace level with a per-session ring buffer
> wait_event_timing: add query-attribution markers to the trace ring
>
> .github/workflows/pg-ci.yml | 7 +
> configure | 32 +
> configure.ac | 8 +
> doc/src/sgml/config.sgml | 106 +
> doc/src/sgml/monitoring.sgml | 783 +++++
> meson.build | 1 +
> meson_options.txt | 3 +
> src/backend/catalog/system_views.sql | 103 +
> src/backend/executor/execMain.c | 5 +
> src/backend/postmaster/auxprocess.c | 11 +
> src/backend/storage/lmgr/proc.c | 5 +
> src/backend/tcop/postgres.c | 39 +
> src/backend/utils/.gitignore | 1 +
> src/backend/utils/Makefile | 9 +-
> src/backend/utils/activity/Makefile | 4 +-
> src/backend/utils/activity/backend_status.c | 13 +
> .../activity/generate-wait_event_types.pl | 179 +
> src/backend/utils/activity/meson.build | 1 +
> src/backend/utils/activity/wait_event.c | 3 +-
> .../utils/activity/wait_event_names.txt | 2 +
> .../utils/activity/wait_event_timing.c | 3112 +++++++++++++++++
> src/backend/utils/init/postinit.c | 11 +
> src/backend/utils/misc/guc_parameters.dat | 29 +
> src/backend/utils/misc/guc_tables.c | 1 +
> src/backend/utils/misc/postgresql.conf.sample | 5 +
> src/include/catalog/pg_proc.dat | 59 +
> src/include/pg_config.h.in | 3 +
> src/include/storage/lwlocklist.h | 2 +
> src/include/storage/subsystemlist.h | 2 +
> src/include/utils/.gitignore | 1 +
> src/include/utils/guc.h | 1 +
> src/include/utils/guc_hooks.h | 3 +
> src/include/utils/meson.build | 4 +-
> src/include/utils/wait_classes.h | 9 +
> src/include/utils/wait_event.h | 49 +
> src/include/utils/wait_event_timing.h | 360 ++
> src/test/modules/test_misc/meson.build | 1 +
> .../t/015_wait_event_trace_seqlock.pl | 122 +
> src/test/regress/expected/rules.out | 30 +
> .../regress/expected/wait_event_timing.out | 188 +
> .../regress/expected/wait_event_timing_1.out | 181 +
> src/test/regress/parallel_schedule | 4 +
> src/test/regress/sql/wait_event_timing.sql | 113 +
> src/tools/pginclude/headerscheck | 2 +
> src/tools/pgindent/typedefs.list | 12 +
> 45 files changed, 5610 insertions(+), 9 deletions(-)
> create mode 100644 src/backend/utils/activity/wait_event_timing.c
> create mode 100644 src/include/utils/wait_event_timing.h
> create mode 100644 src/test/modules/test_misc/t/015_wait_event_trace_seqlock.pl
> create mode 100644 src/test/regress/expected/wait_event_timing.out
> create mode 100644 src/test/regress/expected/wait_event_timing_1.out
> create mode 100644 src/test/regress/sql/wait_event_timing.sql
>
> --
> Dmitry
--
Guillaume Lelarge
Consultant
https://dalibo.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Noah Misch | 2026-07-11 20:14:10 | Re: sequencesync worker race with REFRESH SEQUENCES |
| Previous Message | Thom Brown | 2026-07-11 19:30:18 | Re: SQL/JSON json_table plan clause |