From 8334432d88da229bf462e49b09dac2c0b6b4149e Mon Sep 17 00:00:00 2001 From: Jakub Wartak Date: Fri, 31 Jul 2026 10:13:57 +0200 Subject: [PATCH v22092026 04/11] basebackup: bump SINK_BUFFER_LENGTH to 256kB By increasing SINK_BUFFER_LENGTH size to be closer to modern L2 CPU cache sizes, we are also reducing frequency of the pread() system call which also helps avoids performance penalites (and is visible as one of the top functions when sending backups). In isolated performance runs where pg_basebackup client did not have write it's backup to disk, this gives ~180% of the baseline (3.1GB/s -> 5.5GB/s). Author: Jakub Wartak --- src/backend/backup/basebackup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/backup/basebackup.c b/src/backend/backup/basebackup.c index e3c04ecd810..6478218cc91 100644 --- a/src/backend/backup/basebackup.c +++ b/src/backend/backup/basebackup.c @@ -59,7 +59,7 @@ * NB: The buffer size is required to be a multiple of the system block * size, so use that value instead if it's bigger than our preference. */ -#define SINK_BUFFER_LENGTH Max(32768, BLCKSZ) +#define SINK_BUFFER_LENGTH Max(256 * 1024, BLCKSZ) typedef struct { -- 2.43.5