From 2128de0f3290679d373f80f3ad60382394ee0738 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 29 Aug 2005 21:38:18 +0000 Subject: [PATCH] Reduce default value of max_prepared_transactions from 50 to 5. This saves nearly 700kB in the default shared memory segment size, which seems worthwhile, and it is a feature that many users won't use anyway. Per Heikki's argument, there is no point in a compromise value --- those who are using 2PC at all will probably want it at least equal to max_connections. But we can't set it to zero by default without breaking the prepared_xacts regression test. --- doc/src/sgml/runtime.sgml | 2 +- src/backend/access/transam/twophase.c | 2 +- src/backend/utils/misc/guc.c | 2 +- src/backend/utils/misc/postgresql.conf.sample | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml index b6d85d81bc..1e88e16991 100644 --- a/doc/src/sgml/runtime.sgml +++ b/doc/src/sgml/runtime.sgml @@ -1179,7 +1179,7 @@ SET ENABLE_SEQSCAN TO OFF; endterm="sql-prepare-transaction-title">). Setting this parameter to zero disables the prepared-transaction feature. - The default is 50. + The default is 5. This option can only be set at server start. diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c index d4fe92e4eb..7c8ea844cc 100644 --- a/src/backend/access/transam/twophase.c +++ b/src/backend/access/transam/twophase.c @@ -64,7 +64,7 @@ #define TWOPHASE_DIR "pg_twophase" /* GUC variable, can't be changed after startup */ -int max_prepared_xacts = 50; +int max_prepared_xacts = 5; /* * This struct describes one global transaction that is in prepared state diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 119dc1fc82..a2312e0d04 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -1203,7 +1203,7 @@ static struct config_int ConfigureNamesInt[] = NULL }, &max_prepared_xacts, - 50, 0, INT_MAX, NULL, NULL + 5, 0, INT_MAX, NULL, NULL }, #ifdef LOCK_DEBUG diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index 6049aafe19..910f0212a8 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -90,7 +90,7 @@ #shared_buffers = 1000 # min 16 or max_connections*2, 8KB each #temp_buffers = 1000 # min 100, 8KB each -#max_prepared_transactions = 50 # can be 0 or more +#max_prepared_transactions = 5 # can be 0 or more #work_mem = 1024 # min 64, size in KB #maintenance_work_mem = 16384 # min 1024, size in KB #max_stack_depth = 2048 # min 100, size in KB -- 2.39.5