Thanks to visit codestin.com
Credit goes to doxygen.postgresql.org

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