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

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: Evgeniy Efimkin <efimkin(at)yandex-team(dot)ru>
Cc: legrand legrand <legrand_legrand(at)hotmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [survey] New "Stable" QueryId based on normalized query text
Date: 2019-08-12 13:02:00
Message-ID: CAOBaU_aW0fnF889t-My9pNjOZ2RF7iOGig1TziqZzdtU7g7Xng@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Aug 12, 2019 at 2:52 PM Evgeniy Efimkin <efimkin(at)yandex-team(dot)ru> wrote:
>
> Hi!
> What about adding new column in pg_stat_statements e.g. sql_id it's hash from normalized query. Аnd add function which get that hash (using raw_parser, raw_expression_tree_walker) for any query
> `
> postgres=# select get_queryid('select 1');
> get_queryid
> -------------
> 680388963
> (1 row)

One problem with pg_stat_statement's normalized query is that it's not
stable, it's storing the normalized version of the first query string
passed when an entry is created. So you could have different strings
depending on whether the query was fully qualified or relying on
search path for instance.

Exposing the queryid computation at SQL level has already been
proposed, and FWIW I'm all for it.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Evgeniy Efimkin 2019-08-12 14:01:46 Re: [survey] New "Stable" QueryId based on normalized query text
Previous Message Julien Rouhaud 2019-08-12 12:55:23 Re: [survey] New "Stable" QueryId based on normalized query text