Re: Adding per backend commit and rollback counters

From: Kuba Knysiak <thesniboy(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Subject: Re: Adding per backend commit and rollback counters
Date: 2026-03-30 20:19:13
Message-ID: 177490195327.942.4612952714548351097.pgcf@coridan.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,
after reviewing the patch together with Miłosz, we found the following:

- In pgstatfuncs.c, we call pgstat_fetch_stat_backend_by_pid(beentry->st_procpid, NULL) for each backend row. That path acquires ProcArrayLock via BackendPidGetProc(), so this repeats lock acquisition for every row. We could simplify this and avoid taking the lock altogether by fetching directly with pgstat_fetch_stat_backend(local_beentry->proc_number).

Also, shouldn't this patch bump catversion?

Regards,
Kuba

The new status of this patch is: Waiting on Author

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2026-03-30 20:28:39 Re: WIP - xmlvalidate implementation from TODO list
Previous Message Heikki Linnakangas 2026-03-30 20:15:44 Re: Better shared data structure management and resizable shared data structures