Re: Planning counters in pg_stat_statements (using pgss_store)

Поиск
Список
Период
Сортировка
От Julien Rouhaud
Тема Re: Planning counters in pg_stat_statements (using pgss_store)
Дата
Msg-id CAOBaU_a9yz8Mys+SgM_ww+_LTcFrZ8J3sCs+nBzq5bTwF8BUZw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Planning counters in pg_stat_statements (using pgss_store)  (Michael Paquier <michael@paquier.xyz>)
Ответы Re: Planning counters in pg_stat_statements (using pgss_store)  (Andy Fan <zhihui.fan1213@gmail.com>)
Список pgsql-hackers
Le jeu. 21 mai 2020 à 09:17, Michael Paquier <michael@paquier.xyz> a écrit :
On Thu, May 21, 2020 at 08:49:53AM +0200, Julien Rouhaud wrote:
> On Tue, May 19, 2020 at 4:29 AM Andy Fan <zhihui.fan1213@gmail.com> wrote:
>> Thanks for the excellent extension. I want to add 5 more fields to satisfy the
>> following requirements.
>>
>> int   subplan; /* No. of subplan in this query */
>> int   subquery; /* No. of subquery */
>> int   joincnt; /* How many relations are joined */
>> bool hasagg; /* if we have agg function in this query */
>> bool hasgroup; /* has group clause */
>
> Most of those fields can be computed using the raw sql satements.  Why
> not adding functions like query_has_agg(querytext) to get the
> information from pgss stored query text instead?

Yeah I personally find concepts related only to the query string
itself not something that needs to be tied to pg_stat_statements.
While reading about those five new fields, I am also wondering how
this stuff would work with CTEs.  Particularly, should the hasagg or
hasgroup flags be set only if the most outer query satisfies a
condition?  What if an inner query satisfies a condition but not an
outer query?  Should joincnt just be the sum of all the joins done in
all queries, including subqueries?

Indeed cte will bring additional concerns about the fields semantics. That's another good reason to go with external functions so you can add extra parameters for that if needed. 

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: explicit_bzero for sslpassword
Следующее
От: Fabien COELHO
Дата:
Сообщение: Re: [Proposal] Page Compression for OLTP