From: | Srinath Reddy Sadipiralla <srinath2133(at)gmail(dot)com> |
---|---|
To: | "duomi(dot)peng" <duomi(dot)peng(at)qq(dot)com> |
Cc: | pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: bug reapper: Empty query_id in pg_stat_activity |
Date: | 2025-08-28 11:07:22 |
Message-ID: | CAFC+b6ozO5fse_zF76zzgkD8c2kq0Gb1XFZSecpaeTR=40YoQQ@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Thu, Aug 28, 2025 at 3:09 PM duomi.peng <duomi(dot)peng(at)qq(dot)com> wrote:
> 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
>
Thanks for reporting , I was able to reproduce this locally and my
immediate observation is as we "pgstat_report_query_id(0, true);"
in exec_simple_query which resets the st_query_id to 0 and we use the same
in pg_stat_get_activity which is used to return the query_id in
the pg_stat_activity view because of this the query_id is set to NULL
in pg_stat_activity view , i might be totally wrong here ,please correct me
if i am wrong.
--
Thanks,
Srinath Reddy Sadipiralla
EDB: https://www.enterprisedb.com/
From | Date | Subject | |
---|---|---|---|
Next Message | PG Bug reporting form | 2025-08-28 12:09:30 | BUG #19034: Recursive function with sql_body can replace an existing function but can not be created on it's own |
Previous Message | duomi.peng | 2025-08-28 09:22:24 | bug reapper: Empty query_id in pg_stat_activity |