From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: jinhui.lai@qq.com
Subject: BUG #19363: PostgreSQL shared memory exhaustion during query execution involving views and parallel workers
Date: Fri, 26 Dec 2025 15:07:59 +0000
Message-ID: <19363-8dd32fc7600a1153@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 19363
Logged by: Jinhui Lai
Email address: jinhui.lai@qq.com
PostgreSQL version: 18.1
Operating system: ubuntu 22.04
Description:
Hi, PostgreSQL developers:
Thanks for reading my report. I may find a bug. You can reproduce it as
follows:
CREATE TABLE t0(c0 REAL);
CREATE TABLE t1(c0 REAL);
CREATE TABLE t2(c0 REAL) WITH (parallel_workers=1);
CREATE TABLE t3(c0 REAL) WITH (parallel_workers=2);
CREATE VIEW v0(c0, c1, c2) AS (SELECT t0.c0, t1.c0, t2.c0 FROM t0, t1, t2);
SELECT t3.c0 FROM t3 WHERE NOT EXISTS (SELECT 1 FROM v0 WHERE t3.c0 =
v0.c0);
ERROR: could not resize shared memory segment "/PostgreSQL.3961899888" to
33624064 bytes: No space left on device
When executing a query with a NOT EXISTS subquery referencing a view that
joins multiple tables, PostgreSQL fails with a shared memory allocation
error ("could not resize shared memory segment ... No space left on
device"). The issue appears to be related to parallel query execution, as it
occurs when one of the underlying tables (t3) has parallel_workers set to 2,
while another table (t2) has parallel_workers set to 1. The problem
manifests specifically during the query's execution phase, where the planner
attempts to allocate shared memory for parallel workers, suggesting a
possible resource leak or inadequate cleanup of shared memory segments when
parallel queries involve views. The error persists despite sufficient
available system memory, indicating an internal PostgreSQL resource
management issue rather than a system-level memory constraint.
Best regards,
Jinhui Lai
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: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, jinhui.lai@qq.com
Subject: Re: BUG #19363: PostgreSQL shared memory exhaustion during query execution involving views and parallel workers
In-Reply-To: <19363-8dd32fc7600a1153@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox