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-2021, 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 * Maximum number of columns in an index. There is little point in making
47 * this anything but a multiple of 32, because the main cost is associated
48 * with index tuple header size (see access/itup.h).
50 * Changing this requires an initdb.
52 #define INDEX_MAX_KEYS 32
55 * Maximum number of columns in a partition key
57 #define PARTITION_MAX_KEYS 32
60 * Decide whether built-in 8-byte types, including float8, int8, and
61 * timestamp, are passed by value. This is on by default if sizeof(Datum) >=
62 * 8 (that is, on 64-bit platforms). If sizeof(Datum) < 8 (32-bit platforms),
63 * this must be off. We keep this here as an option so that it is easy to
64 * test the pass-by-reference code paths on 64-bit platforms.
66 * Changing this requires an initdb.
68 #if SIZEOF_VOID_P >= 8
69 #define USE_FLOAT8_BYVAL 1
73 * When we don't have native spinlocks, we use semaphores to simulate them.
74 * Decreasing this value reduces consumption of OS resources; increasing it
75 * may improve performance, but supplying a real spinlock implementation is
76 * probably far better.
78 #define NUM_SPINLOCK_SEMAPHORES 128
81 * When we have neither spinlocks nor atomic operations support we're
82 * implementing atomic operations on top of spinlock on top of semaphores. To
83 * be safe against atomic operations while holding a spinlock separate
84 * semaphores have to be used.
86 #define NUM_ATOMICS_SEMAPHORES 64
89 * MAXPGPATH: standard size of a pathname buffer in PostgreSQL (hence,
90 * maximum usable pathname length is one less).
92 * We'd use a standard system header symbol for this, if there weren't
93 * so many to choose from: MAXPATHLEN, MAX_PATH, PATH_MAX are all
94 * defined by different "standards", and often have different values
95 * on the same platform! So we just punt and use a reasonably
96 * generous setting here.
98 #define MAXPGPATH 1024
101 * PG_SOMAXCONN: maximum accept-queue length limit passed to
102 * listen(2). You'd think we should use SOMAXCONN from
103 * <sys/socket.h>, but on many systems that symbol is much smaller
104 * than the kernel's actual limit. In any case, this symbol need be
105 * twiddled only if you have a kernel that refuses large limit values,
106 * rather than silently reducing the value to what it can handle
107 * (which is what most if not all Unixen do).
109 #define PG_SOMAXCONN 10000
112 * You can try changing this if you have a machine with bytes of
113 * another size, but no guarantee...
115 #define BITS_PER_BYTE 8
118 * Preferred alignment for disk I/O buffers. On some CPUs, copies between
119 * user space and kernel space are significantly faster if the user buffer
120 * is aligned on a larger-than-MAXALIGN boundary. Ideally this should be
121 * a platform-dependent value, but for now we just hard-wire it.
123 #define ALIGNOF_BUFFER 32
126 * If EXEC_BACKEND is defined, the postmaster uses an alternative method for
127 * starting subprocesses: Instead of simply using fork(), as is standard on
128 * Unix platforms, it uses fork()+exec() or something equivalent on Windows,
129 * as well as lots of extra code to bring the required global state to those
130 * new processes. This must be enabled on Windows (because there is no
131 * fork()). On other platforms, it's only useful for verifying those
132 * otherwise Windows-specific code paths.
134 #if defined(WIN32) && !defined(__CYGWIN__)
139 * Define this if your operating system supports link()
141 #if !defined(WIN32) && !defined(__CYGWIN__)
142 #define HAVE_WORKING_LINK 1
146 * USE_POSIX_FADVISE controls whether Postgres will attempt to use the
147 * posix_fadvise() kernel call. Usually the automatic configure tests are
148 * sufficient, but some older Linux distributions had broken versions of
149 * posix_fadvise(). If necessary you can remove the #define here.
151 #if HAVE_DECL_POSIX_FADVISE && defined(HAVE_POSIX_FADVISE)
152 #define USE_POSIX_FADVISE
156 * USE_PREFETCH code should be compiled only if we have a way to implement
157 * prefetching. (This is decoupled from USE_POSIX_FADVISE because there
158 * might in future be support for alternative low-level prefetch APIs.
159 * If you change this, you probably need to adjust the error message in
160 * check_effective_io_concurrency.)
162 #ifdef USE_POSIX_FADVISE
167 * Default and maximum values for backend_flush_after, bgwriter_flush_after
168 * and checkpoint_flush_after; measured in blocks. Currently, these are
169 * enabled by default if sync_file_range() exists, ie, only on Linux. Perhaps
170 * we could also enable by default if we have mmap and msync(MS_ASYNC)?
172 #ifdef HAVE_SYNC_FILE_RANGE
173 #define DEFAULT_BACKEND_FLUSH_AFTER 0 /* never enabled by default */
174 #define DEFAULT_BGWRITER_FLUSH_AFTER 64
175 #define DEFAULT_CHECKPOINT_FLUSH_AFTER 32
177 #define DEFAULT_BACKEND_FLUSH_AFTER 0
178 #define DEFAULT_BGWRITER_FLUSH_AFTER 0
179 #define DEFAULT_CHECKPOINT_FLUSH_AFTER 0
181 /* upper limit for all three variables */
182 #define WRITEBACK_MAX_PENDING_FLUSHES 256
185 * USE_SSL code should be compiled only when compiling with an SSL
193 * This is the default directory in which AF_UNIX socket files are
194 * placed. Caution: changing this risks breaking your existing client
195 * applications, which are likely to continue to look in the old
196 * directory. But if you just hate the idea of sockets in /tmp,
197 * here's where to twiddle it. You can also override this at runtime
198 * with the postmaster's -k switch.
200 * If set to an empty string, then AF_UNIX sockets are not used by default: A
201 * server will not create an AF_UNIX socket unless the run-time configuration
202 * is changed, a client will connect via TCP/IP by default and will only use
203 * an AF_UNIX socket if one is explicitly specified.
205 * This is done by default on Windows because there is no good standard
206 * location for AF_UNIX sockets and many installations on Windows don't
210 #define DEFAULT_PGSOCKET_DIR "/tmp"
212 #define DEFAULT_PGSOCKET_DIR ""
216 * This is the default event source for Windows event log.
218 #define DEFAULT_EVENT_SOURCE "PostgreSQL"
221 * The random() function is expected to yield values between 0 and
222 * MAX_RANDOM_VALUE. Currently, all known implementations yield
223 * 0..2^31-1, so we just hardwire this constant. We could do a
224 * configure test if it proves to be necessary. CAUTION: Think not to
225 * replace this with RAND_MAX. RAND_MAX defines the maximum value of
226 * the older rand() function, which is often different from --- and
227 * considerably inferior to --- random().
229 #define MAX_RANDOM_VALUE PG_INT32_MAX
232 * On PPC machines, decide whether to use the mutex hint bit in LWARX
233 * instructions. Setting the hint bit will slightly improve spinlock
234 * performance on POWER6 and later machines, but does nothing before that,
235 * and will result in illegal-instruction failures on some pre-POWER4
236 * machines. By default we use the hint bit when building for 64-bit PPC,
237 * which should be safe in nearly all cases. You might want to override
238 * this if you are building 32-bit code for a known-recent PPC machine.
240 #ifdef HAVE_PPC_LWARX_MUTEX_HINT /* must have assembler support in any case */
241 #if defined(__ppc64__) || defined(__powerpc64__)
242 #define USE_PPC_LWARX_MUTEX_HINT
247 * On PPC machines, decide whether to use LWSYNC instructions in place of
248 * ISYNC and SYNC. This provides slightly better performance, but will
249 * result in illegal-instruction failures on some pre-POWER4 machines.
250 * By default we use LWSYNC when building for 64-bit PPC, which should be
251 * safe in nearly all cases.
253 #if defined(__ppc64__) || defined(__powerpc64__)
254 #define USE_PPC_LWSYNC
258 * Assumed cache line size. This doesn't affect correctness, but can be used
259 * for low-level optimizations. Currently, this is used to pad some data
260 * structures in xlog.c, to ensure that highly-contended fields are on
261 * different cache lines. Too small a value can hurt performance due to false
262 * sharing, while the only downside of too large a value is a few bytes of
263 * wasted memory. The default is 128, which should be large enough for all
264 * supported platforms.
266 #define PG_CACHE_LINE_SIZE 128
269 *------------------------------------------------------------------------
270 * The following symbols are for enabling debugging code, not for
271 * controlling user-visible features or resource limits.
272 *------------------------------------------------------------------------
276 * Include Valgrind "client requests", mostly in the memory allocator, so
277 * Valgrind understands PostgreSQL memory contexts. This permits detecting
278 * memory errors that Valgrind would not detect on a vanilla build. It also
279 * enables detection of buffer accesses that take place without holding a
280 * buffer pin (or without holding a buffer lock in the case of index access
281 * methods that superimpose their own custom client requests on top of the
282 * generic bufmgr.c requests).
284 * "make installcheck" is significantly slower under Valgrind. The client
285 * requests fall in hot code paths, so USE_VALGRIND slows execution by a few
286 * percentage points even when not run under Valgrind.
288 * Do not try to test the server under Valgrind without having built the
289 * server with USE_VALGRIND; else you will get false positives from sinval
290 * messaging (see comments in AddCatcacheInvalidationMessage). It's also
291 * important to use the suppression file src/tools/valgrind.supp to
292 * exclude other known false positives.
294 * You should normally use MEMORY_CONTEXT_CHECKING with USE_VALGRIND;
295 * instrumentation of repalloc() is inferior without it.
297 /* #define USE_VALGRIND */
300 * Define this to cause pfree()'d memory to be cleared immediately, to
301 * facilitate catching bugs that refer to already-freed values.
302 * Right now, this gets defined automatically if --enable-cassert.
304 #ifdef USE_ASSERT_CHECKING
305 #define CLOBBER_FREED_MEMORY
309 * Define this to check memory allocation errors (scribbling on more
310 * bytes than were allocated). Right now, this gets defined
311 * automatically if --enable-cassert or USE_VALGRIND.
313 #if defined(USE_ASSERT_CHECKING) || defined(USE_VALGRIND)
314 #define MEMORY_CONTEXT_CHECKING
318 * Define this to cause palloc()'d memory to be filled with random data, to
319 * facilitate catching code that depends on the contents of uninitialized
320 * memory. Caution: this is horrendously expensive.
322 /* #define RANDOMIZE_ALLOCATED_MEMORY */
325 * For cache-invalidation debugging, define DISCARD_CACHES_ENABLED to enable
326 * use of the debug_discard_caches GUC to aggressively flush syscache/relcache
327 * entries whenever it's possible to deliver invalidations. See
328 * AcceptInvalidationMessages() in src/backend/utils/cache/inval.c for
331 * USE_ASSERT_CHECKING builds default to enabling this. It's possible to use
332 * DISCARD_CACHES_ENABLED without a cassert build and the implied
333 * CLOBBER_FREED_MEMORY and MEMORY_CONTEXT_CHECKING options, but it's unlikely
334 * to be as effective at identifying problems.
336 /* #define DISCARD_CACHES_ENABLED */
338 #if defined(USE_ASSERT_CHECKING) && !defined(DISCARD_CACHES_ENABLED)
339 #define DISCARD_CACHES_ENABLED
343 * Backwards compatibility for the older compile-time-only clobber-cache
346 #if !defined(DISCARD_CACHES_ENABLED) && (defined(CLOBBER_CACHE_ALWAYS) || defined(CLOBBER_CACHE_RECURSIVELY))
347 #define DISCARD_CACHES_ENABLED
351 * Recover memory used for relcache entries when invalidated. See
352 * RelationBuildDescr() in src/backend/utils/cache/relcache.c.
354 * This is active automatically for clobber-cache builds when clobbering is
355 * active, but can be overridden here by explicitly defining
356 * RECOVER_RELATION_BUILD_MEMORY. Define to 1 to always free relation cache
357 * memory even when clobber is off, or to 0 to never free relation cache
358 * memory even when clobbering is on.
360 /* #define RECOVER_RELATION_BUILD_MEMORY 0 */ /* Force disable */
361 /* #define RECOVER_RELATION_BUILD_MEMORY 1 */ /* Force enable */
364 * Define this to force all parse and plan trees to be passed through
365 * copyObject(), to facilitate catching errors and omissions in
368 /* #define COPY_PARSE_PLAN_TREES */
371 * Define this to force all parse and plan trees to be passed through
372 * outfuncs.c/readfuncs.c, to facilitate catching errors and omissions in
375 /* #define WRITE_READ_PARSE_PLAN_TREES */
378 * Define this to force all raw parse trees for DML statements to be scanned
379 * by raw_expression_tree_walker(), to facilitate catching errors and
380 * omissions in that function.
382 /* #define RAW_EXPRESSION_COVERAGE_TEST */
385 * Enable debugging print statements for lock-related operations.
387 /* #define LOCK_DEBUG */
390 * Enable debugging print statements for WAL-related operations; see
391 * also the wal_debug GUC var.
393 /* #define WAL_DEBUG */
396 * Enable tracing of resource consumption during sort operations;
397 * see also the trace_sort GUC var. For 8.1 this is enabled by default.
402 * Enable tracing of syncscan operations (see also the trace_syncscan GUC var).
404 /* #define TRACE_SYNCSCAN */