compute_query_id

From: Vijaykumar Jain <vijaykumarjain(dot)github(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: compute_query_id
Date: 2021-06-17 14:39:54
Message-ID: CAM+6J945dckHgp7f_nvuOpcOxJLoXsKRtPH6zhFFJZ8f7Ox_ag@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hi,

I noticed this new param compute_query_id in pg14beta.
it is interesting as I was long wanting to identify a query with a unique
id like we have for http requests etc so that we can trace the query all
the way to shards via FDW etc.

but i cannot see them in the logs even after setting compute_query_id on.
i also read
compute_query_id_query
<https://www.postgresql.org/message-id/YHPkU8hFi4no4NSw@paquier.xyz> for
the same.
how is the compute_query_id actually calculated?
why does it show 0 in logs for random sql queries.
log_line_prefix = '%Q :'
0 :LOG: statement: select * from pg_stat_activity;

i mean pid already was doing the job to identify the query and its children
even it logs,
but i know pid will get recycled.
queryjumble.c
<https://github.com/postgres/postgres/blob/cafde58b337e007cb6a719f5ab4dd6459d932a39/src/backend/utils/misc/queryjumble.c>

tldr;
how is compute_query_id different from pid to identify some query running ?
can it be passed on to FDW queries ? for tracing etc ?

am i totally getting its use case totally wrong :)

--
Thanks,
Vijay
Mumbai, India

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Julien Rouhaud 2021-06-17 14:50:26 Re: compute_query_id
Previous Message Erik Brandsberg 2021-06-17 14:22:34 Re: Listen and notify in psql process