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_Ypj92RXfpGkwXO1JKm1rtCYQa3R5zJtherC=TRakceHg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Planning counters in pg_stat_statements (using pgss_store) (Imai Yoshikazu <yoshikazu_i443@live.jp>) |
Ответы |
RE: Planning counters in pg_stat_statements (using pgss_store)
|
Список | pgsql-hackers |
Hello, On Sun, Sep 8, 2019 at 11:45 AM Imai Yoshikazu <yoshikazu_i443@live.jp> wrote: > > I also saw the codes and have one comment. Thanks for looking at this patch! > [0002 patch] > In pgss_planner_hook: > > + /* calc differences of buffer counters. */ > + bufusage = compute_buffer_counters(bufusage_start, pgBufferUsage); > + > + /* > + * we only store planning duration, query text has been initialized > + * during previous pgss_post_parse_analyze as it not available inside > + * pgss_planner_hook. > + */ > + pgss_store(query_text, > > Do we need to calculate bufusage in here? > We only store planning duration in the following pgss_store. Good point! Postgres can definitely access some buffers while planning a query (the most obvious example would be get_actual_variable_range()), but as far as I can tell those were previously not accounted for with pg_stat_statements as queryDesc->totaltime->bufusage is only accumulating buffer usage in the executor, and indeed current patch also ignore such computed counters. I think it would be better to keep this bufusage calculation during planning and fix pgss_store() to process them, but this would add slightly more overhead. > We only store planning duration in the following pgss_store. > > -- > Yoshikazu Imai
В списке pgsql-hackers по дате отправления: