refreshing query id for pg_stat_statements based on comment in sql

From: Zhihong Yu <zyu(at)yugabyte(dot)com>
To: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: refreshing query id for pg_stat_statements based on comment in sql
Date: 2022-03-07 17:42:26
Message-ID: CALNJ-vSijzziYNRD3HTY72Uh+sHSYr5DbfqBKzSvysSvqs9UtQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,
Currently the query id for pg_stat_statements gets calculated based on the
parse nodes specifics.
This means that the user cannot add a comment to a SQL query to test
something. (though some other RDBMS allows this practice).

Consider this use case: for query q, admin looks at stats and performs some
optimization (without changing the query). Admin adds / modifies the
comment for q - now the query becomes q'. If query id doesn't change, there
still would be one row in pg_stat_statements which makes it difficult to
gauge the effectiveness of the tuning.

I want to get opinion from the community whether adding / changing comment
in SQL query should result in new query id for pg_stat_statements.

Cheers

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikolay Shaplov 2022-03-07 17:50:53 Re: [PATCH] minor reloption regression tests improvement
Previous Message Greg Stark 2022-03-07 17:04:49 Re: [PATCH] minor reloption regression tests improvement