pg_config_manual.h 11 KB

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