Re: [survey] New "Stable" QueryId based on normalized query text - Mailing list pgsql-hackers

From Julien Rouhaud
Subject Re: [survey] New "Stable" QueryId based on normalized query text
Date
Msg-id CAOBaU_aW0fnF889t-My9pNjOZ2RF7iOGig1TziqZzdtU7g7Xng@mail.gmail.com
Whole thread Raw
In response to Re: [survey] New "Stable" QueryId based on normalized query text  (Evgeniy Efimkin <efimkin@yandex-team.ru>)
List pgsql-hackers
On Mon, Aug 12, 2019 at 2:52 PM Evgeniy Efimkin <efimkin@yandex-team.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
whichget 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.



pgsql-hackers by date:

Previous
From: Julien Rouhaud
Date:
Subject: Re: [survey] New "Stable" QueryId based on normalized query text
Next
From: Evgeniy Efimkin
Date:
Subject: Re: [survey] New "Stable" QueryId based on normalized query text