hello, everyone!
there is a report: "Empty query_id in pg_stat_activity"
https://www.postgresql.org/message-id/flat/CAJ%2B5Ff4sLuTMpg__fZH67UdaC2bWpLK1U3a8kkj_BvqO8ScYQw%40mail.gmail.com
Maybe it was fixed, but i reappear this bug in pg 15.14.
In my case ,just set compute_query_id = on in PostgreSQL.conf, then reproduce it:
1. in term1:
/opt/pg/15/bin/pgbench -p 1514 -i -s 10 pgbench
/opt/pg/15/bin/pgbench -p 1514 -T 1200 -M simple -d pgbench
2.in term2:
file .psqlrc \pset null 'NULL'
/opt/pg/15/bin/psql -p 1514 -t pgbench
Null display is "NULL".
psql (15.14)
Type "help" for help.
pgbench=# select query_id from pg_stat_activity where pid=7008;
3370541688642856312
pgbench=# \watch 0.2
-7505942672311739493
-7505942672311739493
NULL
-7505942672311739493
-7505942672311739493
NULL
NULL
-7810315603562552972
NULL
-7810315603562552972
NULL
4477171674326430251
-8406700390779190035
-7810315603562552972
....
NULL display the query_id