Re: Report planning memory in EXPLAIN ANALYZE

Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>

From: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: ams@toroid.org, jian he <jian.universality@gmail.com>, Andrei Lepikhov <a.lepikhov@postgrespro.ru>, Andy Fan <zhihui.fan1213@gmail.com>, David Rowley <dgrowleyml@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-01-23T04:46:49Z
Lists: pgsql-hackers

Attachments

On Thu, Jan 18, 2024 at 5:28 PM Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
>
> On 2024-Jan-18, Ashutosh Bapat wrote:
>
> > The EXPLAIN output produces something like below
> >                        explain_filter
> >   ---------------------------------------------------------
> >    Seq Scan on int8_tbl i8  (cost=N.N..N.N rows=N width=N)
> >   Planning:
> >     Memory: used=N bytes, allocated=N bytes
> >  (3 rows)
> >
> > but function explain_filter(), defined in explain.sql, removes line
> > containing Planning: and we end up with output
> >                        explain_filter
> >   ---------------------------------------------------------
> >    Seq Scan on int8_tbl i8  (cost=N.N..N.N rows=N width=N)
> >     Memory: used=N bytes, allocated=N bytes
> >  (2 rows)
> >
> > Hence this weird difference.
>
> Ah, okay, that makes sense.  (I actually think this is a bit insane, and
> I would hope that we can revert commit eabba4a3eb71 eventually, but I
> don't think that needs to hold up your proposed patch.)
>

Thanks. Attached is rebased and squashed patch.


-- 
Best Wishes,
Ashutosh Bapat

Commits

  1. Add EXPLAIN (MEMORY) to report planner memory consumption

  2. Fix explain regression test failure.