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