Make query ID more portable

From: "Andrey V(dot) Lepikhov" <a(dot)lepikhov(at)postgrespro(dot)ru>
To: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: samokhvalov(at)gmail(dot)com, jfinnert(at)amazon(dot)com
Subject: Make query ID more portable
Date: 2021-10-12 08:11:51
Message-ID: e50c1e8f-e5d6-5988-48fa-63dd992e9565@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

QueryID is good tool for query analysis. I want to improve core jumbling
machinery in two ways:
1. QueryID value should survive dump/restore of a database (use fully
qualified name of table instead of relid).
2. QueryID could represent more general class of queries: for example,
it can be independent from permutation of tables in a FROM clause.

See the patch in attachment as an POC. Main idea here is to break
JumbleState down to a 'clocations' part that can be really interested in
a post parse hook and a 'context data', that needed to build query or
subquery signature (hash) and, I guess, isn't really needed in any
extensions.

I think, it adds not much complexity and overhead. It still not
guaranteed equality of queryid on two instances with an equal schema,
but survives across an instance upgrade and allows to do some query
analysis on a replica node.

--
regards,
Andrey Lepikhov
Postgres Professional

Attachment Content-Type Size
0001-Make-queryid-more-portable.patch text/x-patch 30.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2021-10-12 08:33:42 Re: Inconsistency in startup process's MyBackendId and procsignal array registration with ProcSignalInit()
Previous Message Kyotaro Horiguchi 2021-10-12 08:09:44 Re: Inconsistency in startup process's MyBackendId and procsignal array registration with ProcSignalInit()