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