From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: pashutin@gmail.com
Subject: BUG #17494: High demand for displacement sort
Date: Tue, 24 May 2022 11:04:18 +0000
Message-ID: <17494-3a8a5439edcbd4ec@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 17494
Logged by: Владимир Пашутин
Email address: pashutin@gmail.com
PostgreSQL version: 11.14
Operating system: any
Description:
When working with sorting large lists, we often encounter an error:
SQL state [XX000]; error code [0]; ERROR: could not resize shared memory
segment \"/PostgreSQL.932873081\" to 100868096 bytes: Interrupted system
call; nested exception is org.postgresql.util.PSQLException: ERROR: could
not resize shared memory segment \"/PostgreSQL.932873081\" to 100868096
bytes: Interrupted system call
But we almost never need the whole list. Requests are always limited with
LIMIT and OFFSET.
However, from the analysis of the query plan, it turns out that first there
is a complete sorting of the entire result and only then the selection of
the required part of the rows.
The above error also confirms this assumption.
What can be done so that when sorting, the RAM contains only the limit +
offset of the lines and the records read from the disk that have passed the
filtering are checked for falling into the range of lines contained in the
memory, and only after that sorting with displacement is turned on?
This will drastically reduce memory requirements and significantly reduce
the number of comparison operations.
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, pashutin@gmail.com
Subject: Re: BUG #17494: High demand for displacement sort
In-Reply-To: <17494-3a8a5439edcbd4ec@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