Re: [HACKERS] [PATCH] Use $ parameters as replacement characters for pg_stat_statements

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: [HACKERS] [PATCH] Use $ parameters as replacement characters for pg_stat_statements
Дата
Msg-id CAH2-WzkQjyDRdwzqwapZc6aruWDdFHH8hsztax=qk6ukTTuR-w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [HACKERS] [PATCH] Use $ parameters as replacement characters for pg_stat_statements  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [HACKERS] [PATCH] Use $ parameters as replacement characters for pg_stat_statements  (Robert Haas <robertmhaas@gmail.com>)
Re: [HACKERS] [PATCH] Use $ parameters as replacement characters forpg_stat_statements  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-hackers
On Sat, Mar 4, 2017 at 8:02 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Perhaps there could be a choice of behaviors.  Even if we all agreed
>> that parameter notation was better in theory, there's something to be
>> said for maintaining backward compatibility, or having an option to do
>> so.
>
> Meh ... we've generally regretted it when we "solved" a backwards
> compatibility problem by introducing a GUC that changes query semantics.
> I'm inclined to think we should either do it or not.

In my opinion, we expose query id (and dbid, and userid) as the
canonical identifier for each pg_stat_statements entry, and have done
so for some time. That's the stable API -- not query text. I'm aware
of cases where query text was used as an identifier, but that ended up
being hashed anyway.

Query text is just for human consumption. I'd be in favor of a change
that makes it easier to copy and paste a query, to run EXPLAIN and so
on. Lukas probably realizes that there are no guarantees that the
query text that appears in pg_stat_statements will even appear as
normalized in all cases. The "sticky entry" stuff is intended to
maximize the chances of that happening, but it's still generally quite
possible (e.g. pg_stat_statements never swaps constants in a query
like "SELECT 5, pg_stat_statements_reset()"). This means that we
cannot really say that this buys us a machine-readable query text
format, at least not without adding some fairly messy caveats.

-- 
Peter Geoghegan



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: [HACKERS] [PATCH] Use $ parameters as replacement characters forpg_stat_statements
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: [HACKERS] PATCH: pageinspect / add page_checksum andbt_page_items(bytea)