From: | Julien Rouhaud <rjuju123(at)gmail(dot)com> |
---|---|
To: | Imai Yoshikazu <yoshikazu_i443(at)live(dot)jp> |
Cc: | "tomas(dot)vondra(at)2ndquadrant(dot)com" <tomas(dot)vondra(at)2ndquadrant(dot)com>, legrand legrand <legrand_legrand(at)hotmail(dot)com>, "sk(at)zsrv(dot)org" <sk(at)zsrv(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Planning counters in pg_stat_statements (using pgss_store) |
Date: | 2019-09-10 23:27:06 |
Message-ID: | CAOBaU_Ypj92RXfpGkwXO1JKm1rtCYQa3R5zJtherC=TRakceHg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello,
On Sun, Sep 8, 2019 at 11:45 AM Imai Yoshikazu <yoshikazu_i443(at)live(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tsunakawa, Takayuki | 2019-09-11 00:10:59 | RE: Libpq support to connect to standby server as priority |
Previous Message | Nikita Glukhov | 2019-09-10 22:44:28 | Re: [PATCH] Opclass parameters |