pgsql: Increase io_combine_limit range to 1MB.

From: Thomas Munro <tmunro(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Increase io_combine_limit range to 1MB.
Date: 2025-03-19 02:42:41
Message-ID: E1tujOD-003C9f-2A@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Increase io_combine_limit range to 1MB.

The default of 128kB is unchanged, but the upper limit is changed from
32 blocks to 128 blocks, unless the operating system's IOV_MAX is too
low. Some other RDBMSes seem to cap their multi-block buffer pool I/O
around this number, and it seems useful to allow experimentation.

The concrete change is to our definition of PG_IOV_MAX, which provides
the maximum for io_combine_limit and io_max_combine_limit. It also
affects a couple of other places that work with arrays of struct iovec
or smaller objects on the stack, so we still don't want to use the
system IOV_MAX directly without a clamp: it is not under our control and
likely to be 1024. 128 seems acceptable for our current usage.

For Windows, we can't use real scatter/gather yet, so we continue to
define our own IOV_MAX value of 16 and emulate preadv()/pwritev() with
loops. Someone would need to research the trade-offs of raising that
number.

NB if trying to see this working: you might temporarily need to hack
BAS_BULKREAD to be bigger, since otherwise the obvious way of "a very
big SELECT" is limited by that for now.

Suggested-by: Tomas Vondra <tomas(at)vondra(dot)me>
Discussion: https://postgr.es/m/CA%2BhUKG%2B2T9p-%2BzM6Eeou-RAJjTML6eit1qn26f9twznX59qtCA%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/06fb5612c970b3af95aca3db5a955669b07537ca

Modified Files
--------------
doc/src/sgml/config.sgml | 4 ++++
src/backend/storage/aio/read_stream.c | 7 ++++---
src/backend/utils/misc/postgresql.conf.sample | 4 ++--
src/include/port/pg_iovec.h | 8 ++++++--
4 files changed, 16 insertions(+), 7 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Langote 2025-03-19 03:14:56 pgsql: Ensure first ModifyTable rel initialized if all are pruned
Previous Message Tom Lane 2025-03-19 01:24:16 Re: pgsql: aio: Infrastructure for io_method=worker