aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Munro <tmunro@postgresql.org>2024-04-06 23:00:40 +1300
committerThomas Munro <tmunro@postgresql.org>2024-04-06 23:12:03 +1300
commit98f320eb2ef05072b6fe67fcdcdc26c226e6cea4 (patch)
tree861a16c5585355a7fbab449e9f405856eb01f088 /src
parent3bd8439ed628c7e9ac250b1a042d9044303c37e7 (diff)
downloadpostgresql-98f320eb2ef05072b6fe67fcdcdc26c226e6cea4.tar.gz
postgresql-98f320eb2ef05072b6fe67fcdcdc26c226e6cea4.zip
Increase default vacuum_buffer_usage_limit to 2MB.
The BAS_VACUUM ring size has been 256kB since commit d526575f introduced the mechanism 17 years ago. Commit 1cbbee03 recently made it configurable but retained the traditional default. The correct default size has been debated for years, but 256kB is certainly very small. VACUUM soon needs to write back data it dirtied only 32 blocks ago, which usually requires flushing the WAL. New experiments in prefetching pages for VACUUM exacerbated the problem by crashing into dirty data even sooner. Let's make the default 2MB. That's 1.6% of the default toy buffer pool size, and 0.2% of 1GB, which would be a considered a small shared_buffers setting for a real system these days. Users are still free to set the GUC to a different value. Reviewed-by: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/20240403221257.md4gfki3z75cdyf6%40awork3.anarazel.de Discussion: https://postgr.es/m/CA%2BhUKGLY4Q4ZY4f1rvnFtv6%2BPkjNf8MejdPkcju3Qii9DYqqcQ%40mail.gmail.com
Diffstat (limited to 'src')
-rw-r--r--src/backend/storage/buffer/freelist.c2
-rw-r--r--src/backend/utils/init/globals.c2
-rw-r--r--src/backend/utils/misc/guc_tables.c2
-rw-r--r--src/backend/utils/misc/postgresql.conf.sample2
4 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/storage/buffer/freelist.c b/src/backend/storage/buffer/freelist.c
index de2ef1dd5e6..19797de31a9 100644
--- a/src/backend/storage/buffer/freelist.c
+++ b/src/backend/storage/buffer/freelist.c
@@ -561,7 +561,7 @@ GetAccessStrategy(BufferAccessStrategyType btype)
ring_size_kb = 16 * 1024;
break;
case BAS_VACUUM:
- ring_size_kb = 256;
+ ring_size_kb = 2048;
break;
default:
diff --git a/src/backend/utils/init/globals.c b/src/backend/utils/init/globals.c
index 3e38bb1311d..cc61937eef7 100644
--- a/src/backend/utils/init/globals.c
+++ b/src/backend/utils/init/globals.c
@@ -143,7 +143,7 @@ int max_parallel_workers = 8;
int MaxBackends = 0;
/* GUC parameters for vacuum */
-int VacuumBufferUsageLimit = 256;
+int VacuumBufferUsageLimit = 2048;
int VacuumCostPageHit = 1;
int VacuumCostPageMiss = 2;
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index c12784cbec8..7d4e4387cf5 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -2275,7 +2275,7 @@ struct config_int ConfigureNamesInt[] =
GUC_UNIT_KB
},
&VacuumBufferUsageLimit,
- 256, 0, MAX_BAS_VAC_RING_SIZE_KB,
+ 2048, 0, MAX_BAS_VAC_RING_SIZE_KB,
check_vacuum_buffer_usage_limit, NULL, NULL
},
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index baecde28410..2166ea4a87a 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -166,7 +166,7 @@
# mmap
# (change requires restart)
#min_dynamic_shared_memory = 0MB # (change requires restart)
-#vacuum_buffer_usage_limit = 256kB # size of vacuum and analyze buffer access strategy ring;
+#vacuum_buffer_usage_limit = 2MB # size of vacuum and analyze buffer access strategy ring;
# 0 to disable vacuum buffer access strategy;
# range 128kB to 16GB