agora inbox for pgsql-bugs@postgresql.org
help / color / mirror / Atom feedFrom: Justin Pryzby <pryzby@telsasoft.com>
To: Julien Rouhaud <rjuju123@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: BUG #16109: Postgres planning time is high across version (Expose buffer usage during planning in EXPLAIN)
Date: Thu, 23 Jan 2020 23:55:34 -0600
Message-ID: <20200124055534.GM13621@telsasoft.com> (raw)
In-Reply-To: <CAOBaU_ZfSUrU7Cuno_ycJDFDfqJH3jC0=2ou2GkcNy-P0UPy3A@mail.gmail.com>
References: <16109-26a1a88651e90608@postgresql.org>
<20191112205506.rvadbx2dnku3paaw@alap3.anarazel.de>
<CAOBaU_ZfSUrU7Cuno_ycJDFDfqJH3jC0=2ou2GkcNy-P0UPy3A@mail.gmail.com>
On Wed, Nov 13, 2019 at 11:39:04AM +0100, Julien Rouhaud wrote:
> (moved to -hackers)
>
> On Tue, Nov 12, 2019 at 9:55 PM Andres Freund <andres@anarazel.de> wrote:
> >
> > This last point is more oriented towards other PG developers: I wonder
> > if we ought to display buffer statistics for plan time, for EXPLAIN
> > (BUFFERS). That'd surely make it easier to discern cases where we
> > e.g. access the index and scan a lot of the index from cases where we
> > hit some CPU time issue. We should easily be able to get that data, I
> > think, we already maintain it, we'd just need to compute the diff
> > between pgBufferUsage before / after planning.
>
> That would be quite interesting to have. I attach as a reference a
> quick POC patch to implement it:
+1
+ result.shared_blks_hit = stop->shared_blks_hit - start->shared_blks_hit;
+ result.shared_blks_read = stop->shared_blks_read - start->shared_blks_read;
+ result.shared_blks_dirtied = stop->shared_blks_dirtied -
+ start->shared_blks_dirtied;
[...]
I think it would be more readable and maintainable using a macro:
#define CALC_BUFF_DIFF(x) result.##x = stop->##x - start->##x
CALC_BUFF_DIFF(shared_blks_hit);
CALC_BUFF_DIFF(shared_blks_read);
CALC_BUFF_DIFF(shared_blks_dirtied);
...
#undefine CALC_BUFF_DIFF
view thread (20+ messages) latest in thread
Message-ID: <20200124055534.GM13621@telsasoft.com>
Permalink: ../20200124055534.GM13621@telsasoft.com/
Also on: postgresql.org/message-id/20200124055534.GM13621@telsasoft.com
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: pryzby@telsasoft.com, rjuju123@gmail.com, andres@anarazel.de, pgsql-hackers@lists.postgresql.org
Subject: Re: BUG #16109: Postgres planning time is high across version (Expose buffer usage during planning in EXPLAIN)
In-Reply-To: <20200124055534.GM13621@telsasoft.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox