Re: [survey] New "Stable" QueryId based on normalized query text

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: legrand legrand <legrand_legrand(at)hotmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [survey] New "Stable" QueryId based on normalized query text
Date: 2019-03-20 22:56:07
Message-ID: CAOBaU_Yypcom2VxW4mEizx+wAzRdgsn-1jGyZH8seKiLxQNyxQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 20, 2019 at 11:10 PM legrand legrand
<legrand_legrand(at)hotmail(dot)com> wrote:
>
> Thank you Julien for the workaround,
> It is not easy to build "cross tables" in excel to join metrics per query
> text ...

then keep only one queryid over all environments, that's easy enough in SQL:

SELECT min(queryid) OVER (partition by query ORDER BY environment),
... FROM all_pg_stat_statements

if you have your environment named like 0_production,
1_preproduction... you'll get the queryid from production. Once
again, that's not ideal but it's easy to deal with it when consuming
the data.

> and I'm not ready to build a MD5(query) as many query could lead to the same
> QueryId

I'd be really surprised if you see a single collision in your whole
life, whatever pg_stat_statements.max you're using. I'm also pretty
sure that the collision risk is technically higher with an 8B queryId
field rather than a 16B md5, but maybe I'm wrong.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2019-03-20 22:56:59 Re: PostgreSQL pollutes the file system
Previous Message David Rowley 2019-03-20 22:54:49 Re: Removing unneeded self joins