]> granicus.if.org Git - postgresql/blob - src/include/pg_config_manual.h
Fix issues around the "variable" support in the lwlock infrastructure.
[postgresql] / src / include / pg_config_manual.h
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-2015, 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  * Maximum length for identifiers (e.g. table names, column names,
18  * function names).  Names actually are limited to one less byte than this,
19  * because the length must include a trailing zero byte.
20  *
21  * Changing this requires an initdb.
22  */
23 #define NAMEDATALEN 64
24
25 /*
26  * Maximum number of arguments to a function.
27  *
28  * The minimum value is 8 (GIN indexes use 8-argument support functions).
29  * The maximum possible value is around 600 (limited by index tuple size in
30  * pg_proc's index; BLCKSZ larger than 8K would allow more).  Values larger
31  * than needed will waste memory and processing time, but do not directly
32  * cost disk space.
33  *
34  * Changing this does not require an initdb, but it does require a full
35  * backend recompile (including any user-defined C functions).
36  */
37 #define FUNC_MAX_ARGS           100
38
39 /*
40  * Maximum number of columns in an index.  There is little point in making
41  * this anything but a multiple of 32, because the main cost is associated
42  * with index tuple header size (see access/itup.h).
43  *
44  * Changing this requires an initdb.
45  */
46 #define INDEX_MAX_KEYS          32
47
48 /*
49  * Set the upper and lower bounds of sequence values.
50  */
51 #define SEQ_MAXVALUE    PG_INT64_MAX
52 #define SEQ_MINVALUE    (-SEQ_MAXVALUE)
53
54 /*
55  * Number of spare LWLocks to allocate for user-defined add-on code.
56  */
57 #define NUM_USER_DEFINED_LWLOCKS        4
58
59 /*
60  * When we don't have native spinlocks, we use semaphores to simulate them.
61  * Decreasing this value reduces consumption of OS resources; increasing it
62  * may improve performance, but supplying a real spinlock implementation is
63  * probably far better.
64  */
65 #define NUM_SPINLOCK_SEMAPHORES         1024
66
67 /*
68  * When we have neither spinlocks nor atomic operations support we're
69  * implementing atomic operations on top of spinlock on top of semaphores. To
70  * be safe against atomic operations while holding a spinlock separate
71  * semaphores have to be used.
72  */
73 #define NUM_ATOMICS_SEMAPHORES          64
74
75 /*
76  * Define this if you want to allow the lo_import and lo_export SQL
77  * functions to be executed by ordinary users.  By default these
78  * functions are only available to the Postgres superuser.  CAUTION:
79  * These functions are SECURITY HOLES since they can read and write
80  * any file that the PostgreSQL server has permission to access.  If
81  * you turn this on, don't say we didn't warn you.
82  */
83 /* #define ALLOW_DANGEROUS_LO_FUNCTIONS */
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  * PG_SOMAXCONN: maximum accept-queue length limit passed to
99  * listen(2).  You'd think we should use SOMAXCONN from
100  * <sys/socket.h>, but on many systems that symbol is much smaller
101  * than the kernel's actual limit.  In any case, this symbol need be
102  * twiddled only if you have a kernel that refuses large limit values,
103  * rather than silently reducing the value to what it can handle
104  * (which is what most if not all Unixen do).
105  */
106 #define PG_SOMAXCONN    10000
107
108 /*
109  * You can try changing this if you have a machine with bytes of
110  * another size, but no guarantee...
111  */
112 #define BITS_PER_BYTE           8
113
114 /*
115  * Preferred alignment for disk I/O buffers.  On some CPUs, copies between
116  * user space and kernel space are significantly faster if the user buffer
117  * is aligned on a larger-than-MAXALIGN boundary.  Ideally this should be
118  * a platform-dependent value, but for now we just hard-wire it.
119  */
120 #define ALIGNOF_BUFFER  32
121
122 /*
123  * Disable UNIX sockets for certain operating systems.
124  */
125 #if defined(WIN32)
126 #undef HAVE_UNIX_SOCKETS
127 #endif
128
129 /*
130  * Define this if your operating system supports link()
131  */
132 #if !defined(WIN32) && !defined(__CYGWIN__)
133 #define HAVE_WORKING_LINK 1
134 #endif
135
136 /*
137  * USE_POSIX_FADVISE controls whether Postgres will attempt to use the
138  * posix_fadvise() kernel call.  Usually the automatic configure tests are
139  * sufficient, but some older Linux distributions had broken versions of
140  * posix_fadvise().  If necessary you can remove the #define here.
141  */
142 #if HAVE_DECL_POSIX_FADVISE && defined(HAVE_POSIX_FADVISE)
143 #define USE_POSIX_FADVISE
144 #endif
145
146 /*
147  * USE_PREFETCH code should be compiled only if we have a way to implement
148  * prefetching.  (This is decoupled from USE_POSIX_FADVISE because there
149  * might in future be support for alternative low-level prefetch APIs.)
150  */
151 #ifdef USE_POSIX_FADVISE
152 #define USE_PREFETCH
153 #endif
154
155 /*
156  * USE_SSL code should be compiled only when compiling with an SSL
157  * implementation.  (Currently, only OpenSSL is supported, but we might add
158  * more implementations in the future.)
159  */
160 #ifdef USE_OPENSSL
161 #define USE_SSL
162 #endif
163
164 /*
165  * This is the default directory in which AF_UNIX socket files are
166  * placed.  Caution: changing this risks breaking your existing client
167  * applications, which are likely to continue to look in the old
168  * directory.  But if you just hate the idea of sockets in /tmp,
169  * here's where to twiddle it.  You can also override this at runtime
170  * with the postmaster's -k switch.
171  */
172 #define DEFAULT_PGSOCKET_DIR  "/tmp"
173
174 /*
175  * This is the default event source for Windows event log.
176  */
177 #define DEFAULT_EVENT_SOURCE  "PostgreSQL"
178
179 /*
180  * The random() function is expected to yield values between 0 and
181  * MAX_RANDOM_VALUE.  Currently, all known implementations yield
182  * 0..2^31-1, so we just hardwire this constant.  We could do a
183  * configure test if it proves to be necessary.  CAUTION: Think not to
184  * replace this with RAND_MAX.  RAND_MAX defines the maximum value of
185  * the older rand() function, which is often different from --- and
186  * considerably inferior to --- random().
187  */
188 #define MAX_RANDOM_VALUE  PG_INT32_MAX
189
190 /*
191  * On PPC machines, decide whether to use the mutex hint bit in LWARX
192  * instructions.  Setting the hint bit will slightly improve spinlock
193  * performance on POWER6 and later machines, but does nothing before that,
194  * and will result in illegal-instruction failures on some pre-POWER4
195  * machines.  By default we use the hint bit when building for 64-bit PPC,
196  * which should be safe in nearly all cases.  You might want to override
197  * this if you are building 32-bit code for a known-recent PPC machine.
198  */
199 #ifdef HAVE_PPC_LWARX_MUTEX_HINT        /* must have assembler support in any case */
200 #if defined(__ppc64__) || defined(__powerpc64__)
201 #define USE_PPC_LWARX_MUTEX_HINT
202 #endif
203 #endif
204
205 /*
206  * On PPC machines, decide whether to use LWSYNC instructions in place of
207  * ISYNC and SYNC.  This provides slightly better performance, but will
208  * result in illegal-instruction failures on some pre-POWER4 machines.
209  * By default we use LWSYNC when building for 64-bit PPC, which should be
210  * safe in nearly all cases.
211  */
212 #if defined(__ppc64__) || defined(__powerpc64__)
213 #define USE_PPC_LWSYNC
214 #endif
215
216 /*
217  * Assumed cache line size. This doesn't affect correctness, but can be used
218  * for low-level optimizations. Currently, this is used to pad some data
219  * structures in xlog.c, to ensure that highly-contended fields are on
220  * different cache lines. Too small a value can hurt performance due to false
221  * sharing, while the only downside of too large a value is a few bytes of
222  * wasted memory. The default is 128, which should be large enough for all
223  * supported platforms.
224  */
225 #define PG_CACHE_LINE_SIZE              128
226
227 /*
228  *------------------------------------------------------------------------
229  * The following symbols are for enabling debugging code, not for
230  * controlling user-visible features or resource limits.
231  *------------------------------------------------------------------------
232  */
233
234 /*
235  * Include Valgrind "client requests", mostly in the memory allocator, so
236  * Valgrind understands PostgreSQL memory contexts.  This permits detecting
237  * memory errors that Valgrind would not detect on a vanilla build.  See also
238  * src/tools/valgrind.supp.  "make installcheck" runs 20-30x longer under
239  * Valgrind.  Note that USE_VALGRIND slowed older versions of Valgrind by an
240  * additional order of magnitude; Valgrind 3.8.1 does not have this problem.
241  * The client requests fall in hot code paths, so USE_VALGRIND also slows
242  * native execution by a few percentage points.
243  *
244  * You should normally use MEMORY_CONTEXT_CHECKING with USE_VALGRIND;
245  * instrumentation of repalloc() is inferior without it.
246  */
247 /* #define USE_VALGRIND */
248
249 /*
250  * Define this to cause pfree()'d memory to be cleared immediately, to
251  * facilitate catching bugs that refer to already-freed values.
252  * Right now, this gets defined automatically if --enable-cassert.
253  */
254 #ifdef USE_ASSERT_CHECKING
255 #define CLOBBER_FREED_MEMORY
256 #endif
257
258 /*
259  * Define this to check memory allocation errors (scribbling on more
260  * bytes than were allocated).  Right now, this gets defined
261  * automatically if --enable-cassert or USE_VALGRIND.
262  */
263 #if defined(USE_ASSERT_CHECKING) || defined(USE_VALGRIND)
264 #define MEMORY_CONTEXT_CHECKING
265 #endif
266
267 /*
268  * Define this to cause palloc()'d memory to be filled with random data, to
269  * facilitate catching code that depends on the contents of uninitialized
270  * memory.  Caution: this is horrendously expensive.
271  */
272 /* #define RANDOMIZE_ALLOCATED_MEMORY */
273
274 /*
275  * Define this to force all parse and plan trees to be passed through
276  * copyObject(), to facilitate catching errors and omissions in
277  * copyObject().
278  */
279 /* #define COPY_PARSE_PLAN_TREES */
280
281 /*
282  * Enable debugging print statements for lock-related operations.
283  */
284 /* #define LOCK_DEBUG */
285
286 /*
287  * Enable debugging print statements for WAL-related operations; see
288  * also the wal_debug GUC var.
289  */
290 /* #define WAL_DEBUG */
291
292 /*
293  * Enable tracing of resource consumption during sort operations;
294  * see also the trace_sort GUC var.  For 8.1 this is enabled by default.
295  */
296 #define TRACE_SORT 1
297
298 /*
299  * Enable tracing of syncscan operations (see also the trace_syncscan GUC var).
300  */
301 /* #define TRACE_SYNCSCAN */
302
303 /*
304  * Other debug #defines (documentation, anyone?)
305  */
306 /* #define HEAPDEBUGALL */
307 /* #define ACLDEBUG */