Re: compute_query_id and pg_stat_statements

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: compute_query_id and pg_stat_statements
Дата
Msg-id CAFj8pRCWjQtw6A8t335P0soehc0ypjCz38aoASRbP7diWmQmtg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: compute_query_id and pg_stat_statements  (Julien Rouhaud <rjuju123@gmail.com>)
Ответы Re: compute_query_id and pg_stat_statements  (Julien Rouhaud <rjuju123@gmail.com>)
Список pgsql-hackers


st 12. 5. 2021 v 9:13 odesílatel Julien Rouhaud <rjuju123@gmail.com> napsal:
On Wed, May 12, 2021 at 08:58:45AM +0200, Pavel Stehule wrote:
>
> I don't like the idea of implicit force enabling any feature flag, but it
> is better than current design. But it doesn't look like a robust solution.
>
> Does it mean that if somebody disables computed_query_id, then
> pg_stat_statements will not work?

It depends, but if you mean "setting up pg_stat_statements, intentionally
disabling in-core queryid calculation and not configuring an alternative
source" then yes pg_stat_statements will not work.  But I don't see any
difference from "someone reduce wal_level and complain that replication does
not work" or "someone disable fsync and complain that data got corrupted".  We
provide a sensible default configuration, you can mess it up if you don't know
what you're doing.

> Why is there the strong dependency between computed_query_id and
> pg_stat_statements? Can this dependency be just optional?

Once again no, as it otherwise would mean that postgres unilaterally decides
that pg_stat_statements' approach to compute a query identifier is the one and
only ultimate truth and nothing else could be useful for anyone.

ok. Understand.

If I understand well, then computed_query_id does not make sense for pg_stat_statemenst, because this extension always requires it.

Cannot be better to use queryid inside pg_stat_statements every time without dependency on computed_query_id? And computed_query_id can be used only for EXPLAIN and for pg_stat_activity.

pg_stat_statements cannot work without a queryid, so is useless to speak about configuration. If you use pg_stat_statements, then the queryid will be computed every time, but the visibility will be only for pg_stat_statements.

Or a different strategy. I understand so computed_query_id should be active. But I dislike the empty result of pg_stat_statements when computed_query_id is off. Is it possible to raise an exception instead of showing an empty result?

The most correct fix from my perspective is just check in function pg_stat_statements if query id is computed or not. If not, and there is no data, then raise an exception with the hint "enable compute_query_id". When there is data, then show a warning with the mentioned hint and show data.

What do you think about it?

Pavel






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

Предыдущее
От: yuzuko
Дата:
Сообщение: Re: Feedback on table expansion hook (including patch)
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: GetSubscriptionRelations declares too many scan keys