Re: pg_stat_get_backend_subxact() and backend IDs?

From: "Imseih (AWS), Sami" <simseih(at)amazon(dot)com>
To: Ian Lawrence Barwick <barwick(at)gmail(dot)com>, Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, "robertmhaas(at)gmail(dot)com" <robertmhaas(at)gmail(dot)com>
Subject: Re: pg_stat_get_backend_subxact() and backend IDs?
Date: 2023-08-25 15:01:40
Message-ID: 520F48E5-CFE9-45AC-AF81-FC4C63C3A5D2@amazon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2023-08-25 15:32:51 Re: pg_stat_get_backend_subxact() and backend IDs?
Previous Message Vik Fearing 2023-08-25 14:49:50 Re: [PATCH] Add XMLText function (SQL/XML X038)