Re: Proposal: "query_work_mem" GUC, to distribute working memory to the query's individual operators

From: James Hunter <james(dot)hunter(dot)pg(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Proposal: "query_work_mem" GUC, to distribute working memory to the query's individual operators
Date: 2025-04-07 22:36:59
Message-ID: CAJVSvF7HaSz=-b1g5BCUML17=SdjbYV+pSFHH9WuRfRCGScGRw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 4, 2025 at 5:47 PM James Hunter <james(dot)hunter(dot)pg(at)gmail(dot)com> wrote:
>
> Attaching a new revision, which substantially reworks the previous revision --
>

Attaching a rebased revision, with some minor changes.

Also, some context for why this change is especially useful for cloud
variants of PostgreSQL -- if you compare PostgreSQL guidance for
buffer pool size [1] to Amazon Aurora's [2], PostgreSQL recommends the
buffer pool to be sized to 25% of system memory, while Aurora
recommends it to be sized to ~ 70%. PostgreSQL explicitly relies on
the OS filesystem cache, effectively to extend the buffer pool; while
Aurora docs don't mention this at all.

Accordingly, Aurora PostgreSQL queries have less memory to work with
than ordinary PostgreSQL queries, making per-Node memory limits more
important.

Questions, comments?

Thanks,
James

[1] https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-SHARED-BUFFERS
[2] https://docs.aws.amazon.com/prescriptive-guidance/latest/tuning-postgresql-parameters/shared-buffers.html

Attachment Content-Type Size
0002-Add-workmem-estimates-to-Path-node-and-PlannedStmt.patch application/octet-stream 60.3 KB
0004-Add-workmem_hook-to-allow-extensions-to-override-per.patch application/octet-stream 48.4 KB
0001-Store-working-memory-limit-per-Plan-SubPlan-rather-t.patch application/octet-stream 54.1 KB
0003-Add-EXPLAIN-work_mem-on-command-option.patch application/octet-stream 48.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2025-04-07 22:37:49 Re: libpq maligning postgres stability
Previous Message Jacob Champion 2025-04-07 22:26:47 Re: [PoC] Federated Authn/z with OAUTHBEARER