Обсуждение: Query_id is not being populated for all the pids

Поиск
Список
Период
Сортировка

Query_id is not being populated for all the pids

От
Teja Jakkidi
Дата:
Hello Admins,

When we query pg_stat_statements in Postgres, it has a column “query_id” which is not having any value for most of the
sessions. 

Compute_query_id is set to AUTO

Can someone please help me understand why the query_id is missing most of the sessions and how is it populated in the
background?

Thank you,
J. Teja.


Re: Query_id is not being populated for all the pids

От
Erik Wienhold
Дата:
On 2024-05-20 21:48 +0200, Teja Jakkidi wrote:
> When we query pg_stat_statements in Postgres, it has a column
> “query_id” which is not having any value for most of the sessions. 
> 
> Compute_query_id is set to AUTO
> 
> Can someone please help me understand why the query_id is missing most
> of the sessions and how is it populated in the background?

Are you using PgJDBC or the extended query protocol?

This reminds me of this thread:
https://www.postgresql.org/message-id/flat/CA%2B427g8qBArPuqwZOuYVhdoCQUsdbutR18fG7Gt7%2B3JunuHsjA%40mail.gmail.com

That was about pg_stat_activity, though.  But the key take-away was that
query_id is not computed in the extended query protocol which is used by
PgJDBC.

-- 
Erik