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-2020, 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 less 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  * 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).
49  *
50  * Changing this requires an initdb.
51  */
52 #define INDEX_MAX_KEYS 32
53 
54 /*
55  * Maximum number of columns in a partition key
56  */
57 #define PARTITION_MAX_KEYS 32
58 
59 /*
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.
65  *
66  * Changing this requires an initdb.
67  */
68 #if SIZEOF_VOID_P >= 8
69 #define USE_FLOAT8_BYVAL 1
70 #endif
71 
72 /*
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.
77  */
78 #define NUM_SPINLOCK_SEMAPHORES 128
79 
80 /*
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.
85  */
86 #define NUM_ATOMICS_SEMAPHORES 64
87 
88 /*
89  * MAXPGPATH: standard size of a pathname buffer in PostgreSQL (hence,
90  * maximum usable pathname length is one less).
91  *
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.
97  */
98 #define MAXPGPATH 1024
99 
100 /*
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).
108  */
109 #define PG_SOMAXCONN 10000
110 
111 /*
112  * You can try changing this if you have a machine with bytes of
113  * another size, but no guarantee...
114  */
115 #define BITS_PER_BYTE 8
116 
117 /*
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.
122  */
123 #define ALIGNOF_BUFFER 32
124 
125 /*
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.
133  */
134 #if defined(WIN32) && !defined(__CYGWIN__)
135 #define EXEC_BACKEND
136 #endif
137 
138 /*
139  * USE_POSIX_FADVISE controls whether Postgres will attempt to use the
140  * posix_fadvise() kernel call. Usually the automatic configure tests are
141  * sufficient, but some older Linux distributions had broken versions of
142  * posix_fadvise(). If necessary you can remove the #define here.
143  */
144 #if HAVE_DECL_POSIX_FADVISE && defined(HAVE_POSIX_FADVISE)
145 #define USE_POSIX_FADVISE
146 #endif
147 
148 /*
149  * USE_PREFETCH code should be compiled only if we have a way to implement
150  * prefetching. (This is decoupled from USE_POSIX_FADVISE because there
151  * might in future be support for alternative low-level prefetch APIs.
152  * If you change this, you probably need to adjust the error message in
153  * check_effective_io_concurrency.)
154  */
155 #ifdef USE_POSIX_FADVISE
156 #define USE_PREFETCH
157 #endif
158 
159 /*
160  * Default and maximum values for backend_flush_after, bgwriter_flush_after
161  * and checkpoint_flush_after; measured in blocks. Currently, these are
162  * enabled by default if sync_file_range() exists, ie, only on Linux. Perhaps
163  * we could also enable by default if we have mmap and msync(MS_ASYNC)?
164  */
165 #ifdef HAVE_SYNC_FILE_RANGE
166 #define DEFAULT_BACKEND_FLUSH_AFTER 0 /* never enabled by default */
167 #define DEFAULT_BGWRITER_FLUSH_AFTER 64
168 #define DEFAULT_CHECKPOINT_FLUSH_AFTER 32
169 #else
170 #define DEFAULT_BACKEND_FLUSH_AFTER 0
171 #define DEFAULT_BGWRITER_FLUSH_AFTER 0
172 #define DEFAULT_CHECKPOINT_FLUSH_AFTER 0
173 #endif
174 /* upper limit for all three variables */
175 #define WRITEBACK_MAX_PENDING_FLUSHES 256
176 
177 /*
178  * USE_SSL code should be compiled only when compiling with an SSL
179  * implementation. (Currently, only OpenSSL is supported, but we might add
180  * more implementations in the future.)
181  */
182 #ifdef USE_OPENSSL
183 #define USE_SSL
184 #endif
185 
186 /*
187  * This is the default directory in which AF_UNIX socket files are
188  * placed. Caution: changing this risks breaking your existing client
189  * applications, which are likely to continue to look in the old
190  * directory. But if you just hate the idea of sockets in /tmp,
191  * here's where to twiddle it. You can also override this at runtime
192  * with the postmaster's -k switch.
193  *
194  * If set to an empty string, then AF_UNIX sockets are not used by default: A
195  * server will not create an AF_UNIX socket unless the run-time configuration
196  * is changed, a client will connect via TCP/IP by default and will only use
197  * an AF_UNIX socket if one is explicitly specified.
198  *
199  * This is done by default on Windows because there is no good standard
200  * location for AF_UNIX sockets and many installations on Windows don't
201  * support them yet.
202  */
203 #ifndef WIN32
204 #define DEFAULT_PGSOCKET_DIR "/tmp"
205 #else
206 #define DEFAULT_PGSOCKET_DIR ""
207 #endif
208 
209 /*
210  * This is the default event source for Windows event log.
211  */
212 #define DEFAULT_EVENT_SOURCE "PostgreSQL"
213 
214 /*
215  * The random() function is expected to yield values between 0 and
216  * MAX_RANDOM_VALUE. Currently, all known implementations yield
217  * 0..2^31-1, so we just hardwire this constant. We could do a
218  * configure test if it proves to be necessary. CAUTION: Think not to
219  * replace this with RAND_MAX. RAND_MAX defines the maximum value of
220  * the older rand() function, which is often different from --- and
221  * considerably inferior to --- random().
222  */
223 #define MAX_RANDOM_VALUE PG_INT32_MAX
224 
225 /*
226  * On PPC machines, decide whether to use the mutex hint bit in LWARX
227  * instructions. Setting the hint bit will slightly improve spinlock
228  * performance on POWER6 and later machines, but does nothing before that,
229  * and will result in illegal-instruction failures on some pre-POWER4
230  * machines. By default we use the hint bit when building for 64-bit PPC,
231  * which should be safe in nearly all cases. You might want to override
232  * this if you are building 32-bit code for a known-recent PPC machine.
233  */
234 #ifdef HAVE_PPC_LWARX_MUTEX_HINT /* must have assembler support in any case */
235 #if defined(__ppc64__) || defined(__powerpc64__)
236 #define USE_PPC_LWARX_MUTEX_HINT
237 #endif
238 #endif
239 
240 /*
241  * On PPC machines, decide whether to use LWSYNC instructions in place of
242  * ISYNC and SYNC. This provides slightly better performance, but will
243  * result in illegal-instruction failures on some pre-POWER4 machines.
244  * By default we use LWSYNC when building for 64-bit PPC, which should be
245  * safe in nearly all cases.
246  */
247 #if defined(__ppc64__) || defined(__powerpc64__)
248 #define USE_PPC_LWSYNC
249 #endif
250 
251 /*
252  * Assumed cache line size. This doesn't affect correctness, but can be used
253  * for low-level optimizations. Currently, this is used to pad some data
254  * structures in xlog.c, to ensure that highly-contended fields are on
255  * different cache lines. Too small a value can hurt performance due to false
256  * sharing, while the only downside of too large a value is a few bytes of
257  * wasted memory. The default is 128, which should be large enough for all
258  * supported platforms.
259  */
260 #define PG_CACHE_LINE_SIZE 128
261 
262 /*
263  *------------------------------------------------------------------------
264  * The following symbols are for enabling debugging code, not for
265  * controlling user-visible features or resource limits.
266  *------------------------------------------------------------------------
267  */
268 
269 /*
270  * Include Valgrind "client requests", mostly in the memory allocator, so
271  * Valgrind understands PostgreSQL memory contexts. This permits detecting
272  * memory errors that Valgrind would not detect on a vanilla build. See also
273  * src/tools/valgrind.supp. "make installcheck" runs 20-30x longer under
274  * Valgrind. Note that USE_VALGRIND slowed older versions of Valgrind by an
275  * additional order of magnitude; Valgrind 3.8.1 does not have this problem.
276  * The client requests fall in hot code paths, so USE_VALGRIND also slows
277  * native execution by a few percentage points.
278  *
279  * You should normally use MEMORY_CONTEXT_CHECKING with USE_VALGRIND;
280  * instrumentation of repalloc() is inferior without it.
281  */
282 /* #define USE_VALGRIND */
283 
284 /*
285  * Define this to cause pfree()'d memory to be cleared immediately, to
286  * facilitate catching bugs that refer to already-freed values.
287  * Right now, this gets defined automatically if --enable-cassert.
288  */
289 #ifdef USE_ASSERT_CHECKING
290 #define CLOBBER_FREED_MEMORY
291 #endif
292 
293 /*
294  * Define this to check memory allocation errors (scribbling on more
295  * bytes than were allocated). Right now, this gets defined
296  * automatically if --enable-cassert or USE_VALGRIND.
297  */
298 #if defined(USE_ASSERT_CHECKING) || defined(USE_VALGRIND)
299 #define MEMORY_CONTEXT_CHECKING
300 #endif
301 
302 /*
303  * Define this to cause palloc()'d memory to be filled with random data, to
304  * facilitate catching code that depends on the contents of uninitialized
305  * memory. Caution: this is horrendously expensive.
306  */
307 /* #define RANDOMIZE_ALLOCATED_MEMORY */
308 
309 /*
310  * Define this to force all parse and plan trees to be passed through
311  * copyObject(), to facilitate catching errors and omissions in
312  * copyObject().
313  */
314 /* #define COPY_PARSE_PLAN_TREES */
315 
316 /*
317  * Define this to force all parse and plan trees to be passed through
318  * outfuncs.c/readfuncs.c, to facilitate catching errors and omissions in
319  * those modules.
320  */
321 /* #define WRITE_READ_PARSE_PLAN_TREES */
322 
323 /*
324  * Define this to force all raw parse trees for DML statements to be scanned
325  * by raw_expression_tree_walker(), to facilitate catching errors and
326  * omissions in that function.
327  */
328 /* #define RAW_EXPRESSION_COVERAGE_TEST */
329 
330 /*
331  * Enable debugging print statements for lock-related operations.
332  */
333 /* #define LOCK_DEBUG */
334 
335 /*
336  * Enable debugging print statements for WAL-related operations; see
337  * also the wal_debug GUC var.
338  */
339 /* #define WAL_DEBUG */
340 
341 /*
342  * Enable tracing of resource consumption during sort operations;
343  * see also the trace_sort GUC var. For 8.1 this is enabled by default.
344  */
345 #define TRACE_SORT 1
346 
347 /*
348  * Enable tracing of syncscan operations (see also the trace_syncscan GUC var).
349  */
350 /* #define TRACE_SYNCSCAN */