Re: pg_stat_get_backend_subxact() and backend IDs?
Sami Imseih <simseih@amazon.com>
From: "Imseih (AWS), Sami" <simseih@amazon.com>
To: Ian Lawrence Barwick <barwick@gmail.com>, Nathan Bossart <nathandbossart@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>, "robertmhaas@gmail.com" <robertmhaas@gmail.com>
Date: 2023-08-25T15:01:40Z
Lists: pgsql-hackers
I tested the patch and it does the correct thing. I have a few comments: 1/ cast the return of bsearch. This was done previously and is the common convention in the code. So + return bsearch(&key, localBackendStatusTable, localNumBackends, + sizeof(LocalPgBackendStatus), cmp_lbestatus); Should be + return (LocalPgBackendStatus *) bsearch(&key, localBackendStatusTable, localNumBackends, + sizeof(LocalPgBackendStatus), cmp_lbestatus); 2/ This will probably be a good time to update the docs for pg_stat_get_backend_subxact [1] to call out that "subxact_count" will "only increase if a transaction is performing writes". Also to link the reader to the subtransactions doc [2]. 1. https://www.postgresql.org/docs/16/monitoring-stats.html#WAIT-EVENT-TIMEOUT-TABLE 2. https://www.postgresql.org/docs/16/subxacts.html Regards, Sami Imseih Amazon Web Services (AWS)
Commits
-
Use actual backend IDs in pg_stat_get_backend_subxact().
- 133654a05b43 16.0 landed
- d0fe3046eec3 17.0 landed
-
Rename some support functions for pgstat* views.
- 8dfa37b79784 16.0 landed
- 3d51cb5197ea 17.0 landed
-
Expose some information about backend subxact status.
- 10ea0f924a27 16.0 cited