1 /*------------------------------------------------------------------------
2 * PostgreSQL manual configuration settings
4 * This file contains various configuration symbols and limits. In
5 * all cases, changing them is only useful in very rare situations or
6 * for developers. If you edit any of these, be sure to do a *full*
7 * rebuild (and an initdb if noted).
9 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
10 * Portions Copyright (c) 1994, Regents of the University of California
12 * src/include/pg_config_manual.h
13 *------------------------------------------------------------------------
17 * This is the default value for wal_segment_size to be used when initdb is run
18 * without the --wal-segsize option. It must be a valid segment size.
20 #define DEFAULT_XLOG_SEG_SIZE (16*1024*1024)
23 * Maximum length for identifiers (e.g. table names, column names,
24 * function names). Names actually are limited to one fewer byte than this,
25 * because the length must include a trailing zero byte.
27 * Changing this requires an initdb.
29 #define NAMEDATALEN 64
32 * Maximum number of arguments to a function.
34 * The minimum value is 8 (GIN indexes use 8-argument support functions).
35 * The maximum possible value is around 600 (limited by index tuple size in
36 * pg_proc's index; BLCKSZ larger than 8K would allow more). Values larger
37 * than needed will waste memory and processing time, but do not directly
40 * Changing this does not require an initdb, but it does require a full
41 * backend recompile (including any user-defined C functions).
43 #define FUNC_MAX_ARGS 100
46 * When creating a product derived from PostgreSQL with changes that cause
47 * incompatibilities for loadable modules, it is recommended to change this
48 * string so that dfmgr.c can refuse to load incompatible modules with a clean
49 * error message. Typical examples that cause incompatibilities are any
50 * changes to node tags or node structures. (Note that dfmgr.c already
51 * detects common sources of incompatibilities due to major version
52 * differences and due to some changed compile-time constants. This setting
53 * is for catching anything that cannot be detected in a straightforward way.)
55 * There is no prescribed format for the string. The suggestion is to include
56 * product or company name, and optionally any internally-relevant ABI
57 * version. Example: "ACME Postgres/1.2". Note that the string will appear
58 * in a user-facing error message if an ABI mismatch is detected.
60 #define FMGR_ABI_EXTRA "PostgreSQL"
63 * Maximum number of columns in an index. There is little point in making
64 * this anything but a multiple of 32, because the main cost is associated
65 * with index tuple header size (see access/itup.h).
67 * Changing this requires an initdb.
69 #define INDEX_MAX_KEYS 32
72 * Maximum number of columns in a partition key
74 #define PARTITION_MAX_KEYS 32
77 * Decide whether built-in 8-byte types, including float8, int8, and
78 * timestamp, are passed by value. This is on by default if sizeof(Datum) >=
79 * 8 (that is, on 64-bit platforms). If sizeof(Datum) < 8 (32-bit platforms),
80 * this must be off. We keep this here as an option so that it is easy to
81 * test the pass-by-reference code paths on 64-bit platforms.
83 * Changing this requires an initdb.
85 #if SIZEOF_VOID_P >= 8
86 #define USE_FLOAT8_BYVAL 1
90 * When we don't have native spinlocks, we use semaphores to simulate them.
91 * Decreasing this value reduces consumption of OS resources; increasing it
92 * may improve performance, but supplying a real spinlock implementation is
93 * probably far better.
95 #define NUM_SPINLOCK_SEMAPHORES 128
98 * When we have neither spinlocks nor atomic operations support we're
99 * implementing atomic operations on top of spinlock on top of semaphores. To
100 * be safe against atomic operations while holding a spinlock separate
101 * semaphores have to be used.
103 #define NUM_ATOMICS_SEMAPHORES 64
106 * MAXPGPATH: standard size of a pathname buffer in PostgreSQL (hence,
107 * maximum usable pathname length is one less).
109 * We'd use a standard system header symbol for this, if there weren't
110 * so many to choose from: MAXPATHLEN, MAX_PATH, PATH_MAX are all
111 * defined by different "standards", and often have different values
112 * on the same platform! So we just punt and use a reasonably
113 * generous setting here.
115 #define MAXPGPATH 1024
118 * You can try changing this if you have a machine with bytes of
119 * another size, but no guarantee...
121 #define BITS_PER_BYTE 8
124 * Preferred alignment for disk I/O buffers. On some CPUs, copies between
125 * user space and kernel space are significantly faster if the user buffer
126 * is aligned on a larger-than-MAXALIGN boundary. Ideally this should be
127 * a platform-dependent value, but for now we just hard-wire it.
129 #define ALIGNOF_BUFFER 32
132 * If EXEC_BACKEND is defined, the postmaster uses an alternative method for
133 * starting subprocesses: Instead of simply using fork(), as is standard on
134 * Unix platforms, it uses fork()+exec() or something equivalent on Windows,
135 * as well as lots of extra code to bring the required global state to those
136 * new processes. This must be enabled on Windows (because there is no
137 * fork()). On other platforms, it's only useful for verifying those
138 * otherwise Windows-specific code paths.
140 #if defined(WIN32) && !defined(__CYGWIN__)
145 * USE_POSIX_FADVISE controls whether Postgres will attempt to use the
146 * posix_fadvise() kernel call. Usually the automatic configure tests are
147 * sufficient, but some older Linux distributions had broken versions of
148 * posix_fadvise(). If necessary you can remove the #define here.
150 #if HAVE_DECL_POSIX_FADVISE && defined(HAVE_POSIX_FADVISE)
151 #define USE_POSIX_FADVISE
155 * USE_PREFETCH code should be compiled only if we have a way to implement
156 * prefetching. (This is decoupled from USE_POSIX_FADVISE because there
157 * might in future be support for alternative low-level prefetch APIs.
158 * If you change this, you probably need to adjust the error message in
159 * check_effective_io_concurrency.)
161 #ifdef USE_POSIX_FADVISE
166 * Default and maximum values for backend_flush_after, bgwriter_flush_after
167 * and checkpoint_flush_after; measured in blocks. Currently, these are
168 * enabled by default if sync_file_range() exists, ie, only on Linux. Perhaps
169 * we could also enable by default if we have mmap and msync(MS_ASYNC)?
171 #ifdef HAVE_SYNC_FILE_RANGE
172 #define DEFAULT_BACKEND_FLUSH_AFTER 0 /* never enabled by default */
173 #define DEFAULT_BGWRITER_FLUSH_AFTER 64
174 #define DEFAULT_CHECKPOINT_FLUSH_AFTER 32
176 #define DEFAULT_BACKEND_FLUSH_AFTER 0
177 #define DEFAULT_BGWRITER_FLUSH_AFTER 0
178 #define DEFAULT_CHECKPOINT_FLUSH_AFTER 0
180 /* upper limit for all three variables */
181 #define WRITEBACK_MAX_PENDING_FLUSHES 256
184 * USE_SSL code should be compiled only when compiling with an SSL
192 * This is the default directory in which AF_UNIX socket files are
193 * placed. Caution: changing this risks breaking your existing client
194 * applications, which are likely to continue to look in the old
195 * directory. But if you just hate the idea of sockets in /tmp,
196 * here's where to twiddle it. You can also override this at runtime
197 * with the postmaster's -k switch.
199 * If set to an empty string, then AF_UNIX sockets are not used by default: A
200 * server will not create an AF_UNIX socket unless the run-time configuration
201 * is changed, a client will connect via TCP/IP by default and will only use
202 * an AF_UNIX socket if one is explicitly specified.
204 * This is done by default on Windows because there is no good standard
205 * location for AF_UNIX sockets and many installations on Windows don't
209 #define DEFAULT_PGSOCKET_DIR "/tmp"
211 #define DEFAULT_PGSOCKET_DIR ""
215 * This is the default event source for Windows event log.
217 #define DEFAULT_EVENT_SOURCE "PostgreSQL"
220 * Assumed cache line size. This doesn't affect correctness, but can be used
221 * for low-level optimizations. This is mostly used to pad various data
222 * structures, to ensure that highly-contended fields are on different cache
223 * lines. Too small a value can hurt performance due to false sharing, while
224 * the only downside of too large a value is a few bytes of wasted memory.
225 * The default is 128, which should be large enough for all supported
228 #define PG_CACHE_LINE_SIZE 128
231 * Assumed alignment requirement for direct I/O. 4K corresponds to common
232 * sector and memory page size.
234 #define PG_IO_ALIGN_SIZE 4096
237 *------------------------------------------------------------------------
238 * The following symbols are for enabling debugging code, not for
239 * controlling user-visible features or resource limits.
240 *------------------------------------------------------------------------
244 * Include Valgrind "client requests", mostly in the memory allocator, so
245 * Valgrind understands PostgreSQL memory contexts. This permits detecting
246 * memory errors that Valgrind would not detect on a vanilla build. It also
247 * enables detection of buffer accesses that take place without holding a
248 * buffer pin (or without holding a buffer lock in the case of index access
249 * methods that superimpose their own custom client requests on top of the
250 * generic bufmgr.c requests).
252 * "make installcheck" is significantly slower under Valgrind. The client
253 * requests fall in hot code paths, so USE_VALGRIND slows execution by a few
254 * percentage points even when not run under Valgrind.
256 * Do not try to test the server under Valgrind without having built the
257 * server with USE_VALGRIND; else you will get false positives from sinval
258 * messaging (see comments in AddCatcacheInvalidationMessage). It's also
259 * important to use the suppression file src/tools/valgrind.supp to
260 * exclude other known false positives.
262 * You should normally use MEMORY_CONTEXT_CHECKING with USE_VALGRIND;
263 * instrumentation of repalloc() is inferior without it.
265 /* #define USE_VALGRIND */
268 * Define this to cause pfree()'d memory to be cleared immediately, to
269 * facilitate catching bugs that refer to already-freed values.
270 * Right now, this gets defined automatically if --enable-cassert.
272 #ifdef USE_ASSERT_CHECKING
273 #define CLOBBER_FREED_MEMORY
277 * Define this to check memory allocation errors (scribbling on more
278 * bytes than were allocated). Right now, this gets defined
279 * automatically if --enable-cassert or USE_VALGRIND.
281 #if defined(USE_ASSERT_CHECKING) || defined(USE_VALGRIND)
282 #define MEMORY_CONTEXT_CHECKING
286 * Define this to cause palloc()'d memory to be filled with random data, to
287 * facilitate catching code that depends on the contents of uninitialized
288 * memory. Caution: this is horrendously expensive.
290 /* #define RANDOMIZE_ALLOCATED_MEMORY */
293 * For cache-invalidation debugging, define DISCARD_CACHES_ENABLED to enable
294 * use of the debug_discard_caches GUC to aggressively flush syscache/relcache
295 * entries whenever it's possible to deliver invalidations. See
296 * AcceptInvalidationMessages() in src/backend/utils/cache/inval.c for
299 * USE_ASSERT_CHECKING builds default to enabling this. It's possible to use
300 * DISCARD_CACHES_ENABLED without a cassert build and the implied
301 * CLOBBER_FREED_MEMORY and MEMORY_CONTEXT_CHECKING options, but it's unlikely
302 * to be as effective at identifying problems.
304 /* #define DISCARD_CACHES_ENABLED */
306 #if defined(USE_ASSERT_CHECKING) && !defined(DISCARD_CACHES_ENABLED)
307 #define DISCARD_CACHES_ENABLED
311 * Backwards compatibility for the older compile-time-only clobber-cache
314 #if !defined(DISCARD_CACHES_ENABLED) && (defined(CLOBBER_CACHE_ALWAYS) || defined(CLOBBER_CACHE_RECURSIVELY))
315 #define DISCARD_CACHES_ENABLED
319 * Recover memory used for relcache entries when invalidated. See
320 * RelationBuildDesc() in src/backend/utils/cache/relcache.c.
322 * This is active automatically for clobber-cache builds when clobbering is
323 * active, but can be overridden here by explicitly defining
324 * RECOVER_RELATION_BUILD_MEMORY. Define to 1 to always free relation cache
325 * memory even when clobber is off, or to 0 to never free relation cache
326 * memory even when clobbering is on.
328 /* #define RECOVER_RELATION_BUILD_MEMORY 0 */ /* Force disable */
329 /* #define RECOVER_RELATION_BUILD_MEMORY 1 */ /* Force enable */
332 * Define this to force all parse and plan trees to be passed through
333 * copyObject(), to facilitate catching errors and omissions in
336 /* #define COPY_PARSE_PLAN_TREES */
339 * Define this to force all parse and plan trees to be passed through
340 * outfuncs.c/readfuncs.c, to facilitate catching errors and omissions in
343 /* #define WRITE_READ_PARSE_PLAN_TREES */
346 * Define this to force all raw parse trees for DML statements to be scanned
347 * by raw_expression_tree_walker(), to facilitate catching errors and
348 * omissions in that function.
350 /* #define RAW_EXPRESSION_COVERAGE_TEST */
353 * Enable debugging print statements for lock-related operations.
355 /* #define LOCK_DEBUG */
358 * Enable debugging print statements for WAL-related operations; see
359 * also the wal_debug GUC var.
361 /* #define WAL_DEBUG */
364 * Enable tracing of resource consumption during sort operations;
365 * see also the trace_sort GUC var. For 8.1 this is enabled by default.
370 * Enable tracing of syncscan operations (see also the trace_syncscan GUC var).
372 /* #define TRACE_SYNCSCAN */