Re: Report planning memory in EXPLAIN ANALYZE

Abhijit Menon-Sen <ams@toroid.org>

From: Abhijit Menon-Sen <ams@toroid.org>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>, 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-12T17:23:08Z
Lists: pgsql-hackers
At 2024-01-12 17:52:27 +0100, alvherre@alvh.no-ip.org wrote:
>
> I think this patch is mostly OK

(After the last few rounds of changes, it looks fine to me too.)

>  Planning:
>    Buffers: shared hit=120 read=30
>    Memory: used=67944 bytes allocated=73728 bytes
>  Planning Time: 0.892 ms
>
> […]
>
> Or we could leave it as you have it, but to me that's akin to giving up
> on doing it nicely.

For completeness, there's a third option, which is easier to write and a
bit more friendly to the sort of thing that might already be parsing
"Planning Time", viz.,

    Planning Buffers: shared hit=120 read=30
    Planning Memory: used=67944 bytes allocated=73728 bytes
    Planning Time: 0.892 ms

(Those "bytes" look slightly odd to me in the midst of all the x=y
pieces, but that's probably not worth thinking about.)

-- Abhijit



Commits

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

  2. Fix explain regression test failure.