| From: | Lukas Fittl <lukas(at)fittl(dot)com> |
|---|---|
| To: | Andres Freund <andres(at)anarazel(dot)de> |
| Cc: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tomas Vondra <tomas(at)vondra(dot)me>, Peter Smith <smithpb2250(at)gmail(dot)com>, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> |
| Subject: | Re: Stack-based tracking of per-node WAL/buffer usage |
| Date: | 2026-04-07 20:30:11 |
| Message-ID: | CAP53Pkyqsht+exJQYRsjhSWYKu+vFGHhPub7m6PmFD6Or0=p1g@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Mon, Apr 6, 2026 at 5:39 PM Lukas Fittl <lukas(at)fittl(dot)com> wrote:
>
> On Mon, Apr 6, 2026 at 3:46 PM Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> wrote:
> >
> > I couldn't find any issues with v15, all comments are stylistic/minor,
> > except maybe the first one.
>
> Thanks for reviewing!
>
> ...
>
> I'll hold off on posting another patch round since what you raised
> were just small stylistic issues, and they don't apply to the
> remaining prep patches before the stack patch itself.
Attached v16, rebased with Zsolt's feedback addressed. I've also
re-ordered as follows:
0001 is the change to make queryDesc->totaltime be allocated by
ExecutorStart instead of plugins themselves, and adds a
queryDesc->totaltime_options to have plugins request which level of
summary instrumentation they need. This change is pretty simple, and
could still make sense to get into 19. Because of the earlier
Instrumentation refactoring that was pushed (thanks!) we're already
asking extensions allocating queryDesc->totaltime to modify their use
of InstrAlloc, so I think we might as well clean this up now.
0002 is just ExecProcNodeInstr moved to instrument.c, as Andres had
suggested previously. We still get some quick performance wins from
doing that (see end of email), and again, its a simple change, so
could be considered if someone has bandwidth remaining. I've added a
later patch that then does the more complex inlining and gets us the
full speed up.
At this point I'd say its safe to say that we should push out later
changes to PG20, because it needs another good look over, and I don't
think Andres or Heikki have the capacity for that today (but I really
appreciate all the effort put in by both of you!).
---
0002 measurements (with current master and TSC clock source used for
timing, best of three):
CREATE TABLE lotsarows(key int not null);
INSERT INTO lotsarows SELECT generate_series(1, 50000000);
VACUUM FREEZE lotsarows;
master:
265.319 ms actual runtime
308.532 ms TIMING OFF, BUFFERS OFF
375.810 ms TIMING OFF, BUFFERS ON
381.701 ms TIMING ON, BUFFERS OFF
437.722 ms TIMING ON, BUFFERS ON
0002:
265.207 ms actual runtime
291.799 ms TIMING OFF, BUFFERS OFF
364.653 ms TIMING OFF, BUFFERS ON
359.759 ms TIMING ON, BUFFERS OFF
433.023 ms TIMING ON, BUFFERS ON
full patch set:
265.763 ms actual runtime
273.222 ms TIMING OFF, BUFFERS OFF
293.621 ms TIMING OFF, BUFFERS ON
331.926 ms TIMING ON, BUFFERS OFF
363.055 ms TIMING ON, BUFFERS ON
Thanks,
Lukas
--
Lukas Fittl
| Attachment | Content-Type | Size |
|---|---|---|
| v16-0002-instrumentation-Move-ExecProcNodeInstr-to-allow-.patch | application/x-patch | 4.5 KB |
| v16-0004-instrumentation-Replace-direct-changes-of-pgBuff.patch | application/x-patch | 9.0 KB |
| v16-0003-instrumentation-Use-Instrumentation-instead-of-m.patch | application/x-patch | 19.2 KB |
| v16-0001-instrumentation-Allocate-queryDesc-totaltime-in-.patch | application/x-patch | 6.4 KB |
| v16-0005-instrumentation-Add-additional-regression-tests-.patch | application/x-patch | 22.5 KB |
| v16-0007-instrumentation-Use-Instrumentation-struct-for-p.patch | application/x-patch | 29.1 KB |
| v16-0006-Optimize-measuring-WAL-buffer-usage-through-stac.patch | application/x-patch | 81.7 KB |
| v16-0008-instrumentation-Optimize-ExecProcNodeInstr-instr.patch | application/x-patch | 9.0 KB |
| v16-0010-Add-test_session_buffer_usage-test-module.patch | application/x-patch | 30.0 KB |
| v16-0009-Index-scans-Show-table-buffer-accesses-separatel.patch | application/x-patch | 23.2 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Matheus Alcantara | 2026-04-07 21:00:56 | Re: postgres_fdw: Use COPY to speed up batch inserts |
| Previous Message | Andres Freund | 2026-04-07 20:24:04 | Re: Adding REPACK [concurrently] |