Re: pgsql: Add EXPLAIN (MEMORY) to report planner memory consumption

From: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, David Rowley <dgrowleyml(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Subject: Re: pgsql: Add EXPLAIN (MEMORY) to report planner memory consumption
Date: 2024-02-06 09:26:31
Message-ID: CAExHW5v3EwH6SGwewLwr2aDnJePgHYKooOZuOu0XfoGfjths9A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Tue, Feb 6, 2024 at 3:51 AM Justin Pryzby <pryzby(at)telsasoft(dot)com> wrote:
>
> Up to now, the explain " " (two space) format is not mixed with "=".
>
> And, other places which show "Memory" do not use "=". David will
> remember prior discussions.
> https://www.postgresql.org/message-id/20200402054120.GC14618@telsasoft.com
> https://www.postgresql.org/message-id/20200407042521.GH2228@telsasoft.com
>
> "Memory: used=%lld bytes allocated=%lld bytes",
> vs
> "Buckets: %d (originally %d) Batches: %d (originally %d) Memory Usage: %ldkB\n",
>

I have used = to be consistent with Buffers usage in the same Planning section.

Are you suggesting that
"Memory: used=%lld bytes allocated=%lld bytes",
should be used instead of
"Memory: used=%lld bytes allocated=%lld bytes",
Please notice the single vs double space.

I am fine with this.

> There was some discussion about "bytes" - maybe it should instead show
> kB?
>

So EXPLAIN (memory) on a prepared statement may report memory less
than 1kB in which case bytes is a better unit. Planner may consume as
less as few kBs of memory, reporting which in kBs would be lossy.

> (Also, I first thought that "peek" should be "peak", but eventually I
> realized that's it's as intended.)
>

Don't understand the context. But probably it doesn't matter.

--
Best Wishes,
Ashutosh Bapat

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2024-02-06 10:42:09 pgsql: Use atomic access for SlruShared->latest_page_number
Previous Message John Naylor 2024-02-06 07:54:28 pgsql: Further cosmetic review of hashfn_unstable.h

Browse pgsql-hackers by date

  From Date Subject
Next Message Ильясов Ян 2024-02-06 09:34:42 Memory leak fix in rmtree.c
Previous Message Richard Guo 2024-02-06 09:05:33 Re: Properly pathify the union planner