PostgreSQL Source Code
git master
pg_config_manual.h
Go to the documentation of this file.
1
/*------------------------------------------------------------------------
2
* PostgreSQL manual configuration settings
3
*
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).
8
*
9
* Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
10
* Portions Copyright (c) 1994, Regents of the University of California
11
*
12
* src/include/pg_config_manual.h
13
*------------------------------------------------------------------------
14
*/
15
16
/*
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.
19
*/
20
#define DEFAULT_XLOG_SEG_SIZE (16*1024*1024)
21
22
/*
23
* SLRU segment size. A page is the same BLCKSZ as is used everywhere else in
24
* Postgres. The segment size can be chosen somewhat arbitrarily; we make it
25
* 32 pages by default, or 256Kb, i.e. 1M transactions for CLOG or 64K
26
* transactions for SUBTRANS.
27
*
28
* Changing this requires an initdb.
29
*/
30
#define SLRU_PAGES_PER_SEGMENT 32
31
32
/*
33
* Maximum length for identifiers (e.g. table names, column names,
34
* function names). Names actually are limited to one fewer byte than this,
35
* because the length must include a trailing zero byte.
36
*
37
* Changing this requires an initdb.
38
*/
39
#define NAMEDATALEN 64
40
41
/*
42
* Maximum number of arguments to a function.
43
*
44
* The minimum value is 8 (GIN indexes use 8-argument support functions).
45
* The maximum possible value is around 600 (limited by index tuple size in
46
* pg_proc's index; BLCKSZ larger than 8K would allow more). Values larger
47
* than needed will waste memory and processing time, but do not directly
48
* cost disk space.
49
*
50
* Changing this does not require an initdb, but it does require a full
51
* backend recompile (including any user-defined C functions).
52
*/
53
#define FUNC_MAX_ARGS 100
54
55
/*
56
* When creating a product derived from PostgreSQL with changes that cause
57
* incompatibilities for loadable modules, it is recommended to change this
58
* string so that dfmgr.c can refuse to load incompatible modules with a clean
59
* error message. Typical examples that cause incompatibilities are any
60
* changes to node tags or node structures. (Note that dfmgr.c already
61
* detects common sources of incompatibilities due to major version
62
* differences and due to some changed compile-time constants. This setting
63
* is for catching anything that cannot be detected in a straightforward way.)
64
*
65
* There is no prescribed format for the string. The suggestion is to include
66
* product or company name, and optionally any internally-relevant ABI
67
* version. Example: "ACME Postgres/1.2". Note that the string will appear
68
* in a user-facing error message if an ABI mismatch is detected.
69
*/
70
#define FMGR_ABI_EXTRA "PostgreSQL"
71
72
/*
73
* Maximum number of columns in an index. There is little point in making
74
* this anything but a multiple of 32, because the main cost is associated
75
* with index tuple header size (see access/itup.h).
76
*
77
* Changing this requires an initdb.
78
*/
79
#define INDEX_MAX_KEYS 32
80
81
/*
82
* Maximum number of columns in a partition key
83
*/
84
#define PARTITION_MAX_KEYS 32
85
86
/*
87
* This symbol is now vestigial: built-in 8-byte types, including float8,
88
* int8, and timestamp, are always passed by value since we require Datum
89
* to be wide enough to permit that. We continue to define the symbol here
90
* so as not to unnecessarily break extension code.
91
*/
92
#define USE_FLOAT8_BYVAL 1
93
94
95
/*
96
* MAXPGPATH: standard size of a pathname buffer in PostgreSQL (hence,
97
* maximum usable pathname length is one less).
98
*
99
* We'd use a standard system header symbol for this, if there weren't
100
* so many to choose from: MAXPATHLEN, MAX_PATH, PATH_MAX are all
101
* defined by different "standards", and often have different values
102
* on the same platform! So we just punt and use a reasonably
103
* generous setting here.
104
*/
105
#define MAXPGPATH 1024
106
107
/*
108
* You can try changing this if you have a machine with bytes of
109
* another size, but no guarantee...
110
*/
111
#define BITS_PER_BYTE 8
112
113
/*
114
* Preferred alignment for disk I/O buffers. On some CPUs, copies between
115
* user space and kernel space are significantly faster if the user buffer
116
* is aligned on a larger-than-MAXALIGN boundary. Ideally this should be
117
* a platform-dependent value, but for now we just hard-wire it.
118
*/
119
#define ALIGNOF_BUFFER 32
120
121
/*
122
* If EXEC_BACKEND is defined, the postmaster uses an alternative method for
123
* starting subprocesses: Instead of simply using fork(), as is standard on
124
* Unix platforms, it uses fork()+exec() or something equivalent on Windows,
125
* as well as lots of extra code to bring the required global state to those
126
* new processes. This must be enabled on Windows (because there is no
127
* fork()). On other platforms, it's only useful for verifying those
128
* otherwise Windows-specific code paths.
129
*/
130
#if defined(WIN32) && !defined(__CYGWIN__)
131
#define EXEC_BACKEND
132
#endif
133
134
/*
135
* USE_POSIX_FADVISE controls whether Postgres will attempt to use the
136
* posix_fadvise() kernel call. Usually the automatic configure tests are
137
* sufficient, but some older Linux distributions had broken versions of
138
* posix_fadvise(). If necessary you can remove the #define here.
139
*/
140
#if HAVE_DECL_POSIX_FADVISE && defined(HAVE_POSIX_FADVISE)
141
#define USE_POSIX_FADVISE
142
#endif
143
144
/*
145
* USE_PREFETCH code should be compiled only if we have a way to implement
146
* prefetching. (This is decoupled from USE_POSIX_FADVISE because there
147
* might in future be support for alternative low-level prefetch APIs,
148
* as well as platform-specific APIs defined elsewhere.)
149
*/
150
#ifdef USE_POSIX_FADVISE
151
#define USE_PREFETCH
152
#endif
153
154
/*
155
* Default and maximum values for backend_flush_after, bgwriter_flush_after
156
* and checkpoint_flush_after; measured in blocks. Currently, these are
157
* enabled by default if sync_file_range() exists, ie, only on Linux. Perhaps
158
* we could also enable by default if we have mmap and msync(MS_ASYNC)?
159
*/
160
#ifdef HAVE_SYNC_FILE_RANGE
161
#define DEFAULT_BACKEND_FLUSH_AFTER 0
/* never enabled by default */
162
#define DEFAULT_BGWRITER_FLUSH_AFTER 64
163
#define DEFAULT_CHECKPOINT_FLUSH_AFTER 32
164
#else
165
#define DEFAULT_BACKEND_FLUSH_AFTER 0
166
#define DEFAULT_BGWRITER_FLUSH_AFTER 0
167
#define DEFAULT_CHECKPOINT_FLUSH_AFTER 0
168
#endif
169
/* upper limit for all three variables */
170
#define WRITEBACK_MAX_PENDING_FLUSHES 256
171
172
/*
173
* USE_SSL code should be compiled only when compiling with an SSL
174
* implementation.
175
*/
176
#ifdef USE_OPENSSL
177
#define USE_SSL
178
#endif
179
180
/*
181
* This is the default directory in which AF_UNIX socket files are
182
* placed. Caution: changing this risks breaking your existing client
183
* applications, which are likely to continue to look in the old
184
* directory. But if you just hate the idea of sockets in /tmp,
185
* here's where to twiddle it. You can also override this at runtime
186
* with the postmaster's -k switch.
187
*
188
* If set to an empty string, then AF_UNIX sockets are not used by default: A
189
* server will not create an AF_UNIX socket unless the run-time configuration
190
* is changed, a client will connect via TCP/IP by default and will only use
191
* an AF_UNIX socket if one is explicitly specified.
192
*
193
* This is done by default on Windows because there is no good standard
194
* location for AF_UNIX sockets and many installations on Windows don't
195
* support them yet.
196
*/
197
#ifndef WIN32
198
#define DEFAULT_PGSOCKET_DIR "/tmp"
199
#else
200
#define DEFAULT_PGSOCKET_DIR ""
201
#endif
202
203
/*
204
* This is the default event source for Windows event log.
205
*/
206
#define DEFAULT_EVENT_SOURCE "PostgreSQL"
207
208
/*
209
* Assumed cache line size. This doesn't affect correctness, but can be used
210
* for low-level optimizations. This is mostly used to pad various data
211
* structures, to ensure that highly-contended fields are on different cache
212
* lines. Too small a value can hurt performance due to false sharing, while
213
* the only downside of too large a value is a few bytes of wasted memory.
214
* The default is 128, which should be large enough for all supported
215
* platforms.
216
*/
217
#define PG_CACHE_LINE_SIZE 128
218
219
/*
220
* Assumed alignment requirement for direct I/O. 4K corresponds to common
221
* sector and memory page size.
222
*/
223
#define PG_IO_ALIGN_SIZE 4096
224
225
/*
226
*------------------------------------------------------------------------
227
* The following symbols are for enabling debugging code, not for
228
* controlling user-visible features or resource limits.
229
*------------------------------------------------------------------------
230
*/
231
232
/*
233
* Force use of the non-recursive JSON parser in all cases. This is useful
234
* to validate the working of the parser, and the regression tests should
235
* pass except for some different error messages about the stack limit.
236
*/
237
/* #define FORCE_JSON_PSTACK */
238
239
/*
240
* Include Valgrind "client requests", mostly in the memory allocator, so
241
* Valgrind understands PostgreSQL memory contexts. This permits detecting
242
* memory errors that Valgrind would not detect on a vanilla build. It also
243
* enables detection of buffer accesses that take place without holding a
244
* buffer pin (or without holding a buffer lock in the case of index access
245
* methods that superimpose their own custom client requests on top of the
246
* generic bufmgr.c requests).
247
*
248
* "make installcheck" is significantly slower under Valgrind. The client
249
* requests fall in hot code paths, so USE_VALGRIND slows execution by a few
250
* percentage points even when not run under Valgrind.
251
*
252
* Do not try to test the server under Valgrind without having built the
253
* server with USE_VALGRIND; else you will get false positives from sinval
254
* messaging (see comments in AddCatcacheInvalidationMessage). It's also
255
* important to use the suppression file src/tools/valgrind.supp to
256
* exclude other known false positives.
257
*
258
* You should normally use MEMORY_CONTEXT_CHECKING with USE_VALGRIND;
259
* instrumentation of repalloc() is inferior without it.
260
*/
261
/* #define USE_VALGRIND */
262
263
/*
264
* Define this to cause pfree()'d memory to be cleared immediately, to
265
* facilitate catching bugs that refer to already-freed values.
266
* Right now, this gets defined automatically if --enable-cassert.
267
*/
268
#ifdef USE_ASSERT_CHECKING
269
#define CLOBBER_FREED_MEMORY
270
#endif
271
272
/*
273
* Define this to check memory allocation errors (scribbling on more
274
* bytes than were allocated). Right now, this gets defined
275
* automatically if --enable-cassert or USE_VALGRIND.
276
*/
277
#if defined(USE_ASSERT_CHECKING) || defined(USE_VALGRIND)
278
#define MEMORY_CONTEXT_CHECKING
279
#endif
280
281
/*
282
* Define this to cause palloc()'d memory to be filled with random data, to
283
* facilitate catching code that depends on the contents of uninitialized
284
* memory. Caution: this is horrendously expensive.
285
*/
286
/* #define RANDOMIZE_ALLOCATED_MEMORY */
287
288
/*
289
* For cache-invalidation debugging, define DISCARD_CACHES_ENABLED to enable
290
* use of the debug_discard_caches GUC to aggressively flush
291
* syscache/relcache/relsynccache entries whenever it's possible to deliver
292
* invalidations. See AcceptInvalidationMessages() in
293
* src/backend/utils/cache/inval.c for details.
294
*
295
* USE_ASSERT_CHECKING builds default to enabling this. It's possible to use
296
* DISCARD_CACHES_ENABLED without a cassert build and the implied
297
* CLOBBER_FREED_MEMORY and MEMORY_CONTEXT_CHECKING options, but it's unlikely
298
* to be as effective at identifying problems.
299
*/
300
/* #define DISCARD_CACHES_ENABLED */
301
302
#if defined(USE_ASSERT_CHECKING) && !defined(DISCARD_CACHES_ENABLED)
303
#define DISCARD_CACHES_ENABLED
304
#endif
305
306
/*
307
* Backwards compatibility for the older compile-time-only clobber-cache
308
* macros.
309
*/
310
#if !defined(DISCARD_CACHES_ENABLED) && (defined(CLOBBER_CACHE_ALWAYS) || defined(CLOBBER_CACHE_RECURSIVELY))
311
#define DISCARD_CACHES_ENABLED
312
#endif
313
314
/*
315
* Recover memory used for relcache entries when invalidated. See
316
* RelationBuildDesc() in src/backend/utils/cache/relcache.c.
317
*
318
* This is active automatically for clobber-cache builds when clobbering is
319
* active, but can be overridden here by explicitly defining
320
* RECOVER_RELATION_BUILD_MEMORY. Define to 1 to always free relation cache
321
* memory even when clobber is off, or to 0 to never free relation cache
322
* memory even when clobbering is on.
323
*/
324
/* #define RECOVER_RELATION_BUILD_MEMORY 0 */
/* Force disable */
325
/* #define RECOVER_RELATION_BUILD_MEMORY 1 */
/* Force enable */
326
327
/*
328
* Define DEBUG_NODE_TESTS_ENABLED to enable use of the GUCs
329
* debug_copy_parse_plan_trees, debug_write_read_parse_plan_trees, and
330
* debug_raw_expression_coverage_test, to test coverage of node support
331
* functions in src/backend/nodes/.
332
*
333
* USE_ASSERT_CHECKING builds default to enabling this.
334
*/
335
/* #define DEBUG_NODE_TESTS_ENABLED */
336
337
#if defined(USE_ASSERT_CHECKING) && !defined(DEBUG_NODE_TESTS_ENABLED)
338
#define DEBUG_NODE_TESTS_ENABLED
339
#endif
340
341
/*
342
* Backwards compatibility for the older compile-time-only node-tests macros.
343
*/
344
#if !defined(DEBUG_NODE_TESTS_ENABLED) && (defined(COPY_PARSE_PLAN_TREES) || defined(WRITE_READ_PARSE_PLAN_TREES) || defined(RAW_EXPRESSION_COVERAGE_TEST))
345
#define DEBUG_NODE_TESTS_ENABLED
346
#endif
347
348
/*
349
* Define this to force Bitmapset reallocation on each modification. Helps
350
* to find dangling pointers to Bitmapset's.
351
*/
352
/* #define REALLOCATE_BITMAPSETS */
353
354
/*
355
* Enable debugging print statements for lock-related operations.
356
*/
357
/* #define LOCK_DEBUG */
358
359
/*
360
* Enable debugging print statements for WAL-related operations; see
361
* also the wal_debug GUC var.
362
*/
363
/* #define WAL_DEBUG */
364
365
/*
366
* Enable tracing of syncscan operations (see also the trace_syncscan GUC var).
367
*/
368
/* #define TRACE_SYNCSCAN */
src
include
pg_config_manual.h
Generated on Mon Nov 24 2025 06:13:17 for PostgreSQL Source Code by
1.9.4