public inbox for [email protected]help / color / mirror / Atom feed
Empty query_id in pg_stat_activity 3+ messages / 2 participants [nested] [flat]
* Empty query_id in pg_stat_activity @ 2024-12-06 14:32 Costa Alexoglou <[email protected]> 0 siblings, 1 reply; 3+ messages in thread From: Costa Alexoglou @ 2024-12-06 14:32 UTC (permalink / raw) To: [email protected] <[email protected]> Hey folks, I am running Benchbase and pgbench at the same time just for debugging purposes, and I notice that sometimes query_id is missing from pg_stat_activity. Any clue why this is happening? ``` benchbase=# SELECT query_id, now() - query_start as duration, query FROM pg_stat_activity WHERE state = 'active' AND backend_type = 'client backend' ORDER BY duration DESC LIMIT 5; query_id | duration | query ---------------------+------------------+------------------------------------------------------------------------ | 00:00:00.223544 | SELECT + | | s_suppkey, + | | s_name, + | | s_address, + | | s_phone, + | | total_revenue + | | FROM + | | supplier, + | | revenue0 + | | WHERE + | | s_suppkey = supplier_no + | | AND total_revenue = ( + | | SELECT + | | MAX(total_revenue) + | | FROM + | | revenue0 + | | ) + | | ORDER BY + | | s_suppkey + | | 3080582906387216276 | 00:00:00.000032 | UPDATE pgbench_branches SET bbalance = bbalance + -4897 WHERE bid = 8; 3080582906387216276 | -00:00:00.000321 | UPDATE pgbench_branches SET bbalance = bbalance + -377 WHERE bid = 6; 2064869707185898531 | -00:00:00.000501 | END; 2064869707185898531 | -00:00:00.000502 | END; (5 rows) ``` Cheers, Costa ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Empty query_id in pg_stat_activity @ 2024-12-06 15:44 Erik Wienhold <[email protected]> parent: Costa Alexoglou <[email protected]> 0 siblings, 1 reply; 3+ messages in thread From: Erik Wienhold @ 2024-12-06 15:44 UTC (permalink / raw) To: Costa Alexoglou <[email protected]>; +Cc: [email protected] <[email protected]> On 2024-12-06 15:32 +0100, Costa Alexoglou wrote: > Hey folks, I am running Benchbase and pgbench at the same time just for > debugging purposes, and I notice that sometimes query_id is missing > from pg_stat_activity. Any clue why this is happening? What's your Postgres version? Could be that query_id is not reported because the session is using the extended query protocol. This has been fixed just recently in releases 14.14/15.9/16.5/17.1. From the 14.14 release notes: > * Report the active query ID for statistics purposes at the start of > processing of Bind and Execute protocol messages (Sami Imseih) > https://postgr.es/c/b36ee879c > > This allows more of the work done in extended query protocol to be > attributed to the correct query. Another possibility is that the session just disabled compute_query_id: https://postgr.es/m/472115375.225506.1683812791906%40office.mailbox.org -- Erik ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Empty query_id in pg_stat_activity @ 2024-12-12 20:37 Erik Wienhold <[email protected]> parent: Erik Wienhold <[email protected]> 0 siblings, 0 replies; 3+ messages in thread From: Erik Wienhold @ 2024-12-12 20:37 UTC (permalink / raw) To: Costa Alexoglou <[email protected]>; +Cc: [email protected] On 2024-12-10 14:33 +0100, Costa Alexoglou wrote: > On Fri, Dec 6, 2024 at 4:44 PM Erik Wienhold <[email protected]> wrote: > > What's your Postgres version? > It was `16.1`, run with `16.6` and indeed the query_id is there. Thanks! Please reply to list as well. CC'ed it now. -- Erik ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2024-12-12 20:37 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2024-12-06 14:32 Empty query_id in pg_stat_activity Costa Alexoglou <[email protected]> 2024-12-06 15:44 ` Erik Wienhold <[email protected]> 2024-12-12 20:37 ` Erik Wienhold <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox