Re: pg_stat_get_backend_subxact() and backend IDs? - Mailing list pgsql-hackers

From Imseih (AWS), Sami
Subject Re: pg_stat_get_backend_subxact() and backend IDs?
Date
Msg-id 520F48E5-CFE9-45AC-AF81-FC4C63C3A5D2@amazon.com
Whole thread Raw
In response to Re: pg_stat_get_backend_subxact() and backend IDs?  (Ian Lawrence Barwick <barwick@gmail.com>)
Responses Re: pg_stat_get_backend_subxact() and backend IDs?
List 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)


pgsql-hackers by date:

Previous
From: Vik Fearing
Date:
Subject: Re: [PATCH] Add XMLText function (SQL/XML X038)
Next
From: Nathan Bossart
Date:
Subject: Re: pg_stat_get_backend_subxact() and backend IDs?