pg_config_manual.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  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-2022, 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. * This is the default value for wal_segment_size to be used when initdb is run
  17. * without the --wal-segsize option. It must be a valid segment size.
  18. */
  19. #define DEFAULT_XLOG_SEG_SIZE (16*1024*1024)
  20. /*
  21. * Maximum length for identifiers (e.g. table names, column names,
  22. * function names). Names actually are limited to one fewer byte than this,
  23. * because the length must include a trailing zero byte.
  24. *
  25. * Changing this requires an initdb.
  26. */
  27. #define NAMEDATALEN 64
  28. /*
  29. * Maximum number of arguments to a function.
  30. *
  31. * The minimum value is 8 (GIN indexes use 8-argument support functions).
  32. * The maximum possible value is around 600 (limited by index tuple size in
  33. * pg_proc's index; BLCKSZ larger than 8K would allow more). Values larger
  34. * than needed will waste memory and processing time, but do not directly
  35. * cost disk space.
  36. *
  37. * Changing this does not require an initdb, but it does require a full
  38. * backend recompile (including any user-defined C functions).
  39. */
  40. #define FUNC_MAX_ARGS 100
  41. /*
  42. * When creating a product derived from PostgreSQL with changes that cause
  43. * incompatibilities for loadable modules, it is recommended to change this
  44. * string so that dfmgr.c can refuse to load incompatible modules with a clean
  45. * error message. Typical examples that cause incompatibilities are any
  46. * changes to node tags or node structures. (Note that dfmgr.c already
  47. * detects common sources of incompatibilities due to major version
  48. * differences and due to some changed compile-time constants. This setting
  49. * is for catching anything that cannot be detected in a straightforward way.)
  50. *
  51. * There is no prescribed format for the string. The suggestion is to include
  52. * product or company name, and optionally any internally-relevant ABI
  53. * version. Example: "ACME Postgres/1.2". Note that the string will appear
  54. * in a user-facing error message if an ABI mismatch is detected.
  55. */
  56. #define FMGR_ABI_EXTRA "PostgreSQL"
  57. /*
  58. * Maximum number of columns in an index. There is little point in making
  59. * this anything but a multiple of 32, because the main cost is associated
  60. * with index tuple header size (see access/itup.h).
  61. *
  62. * Changing this requires an initdb.
  63. */
  64. #define INDEX_MAX_KEYS 32
  65. /*
  66. * Maximum number of columns in a partition key
  67. */
  68. #define PARTITION_MAX_KEYS 32
  69. /*
  70. * Decide whether built-in 8-byte types, including float8, int8, and
  71. * timestamp, are passed by value. This is on by default if sizeof(Datum) >=
  72. * 8 (that is, on 64-bit platforms). If sizeof(Datum) < 8 (32-bit platforms),
  73. * this must be off. We keep this here as an option so that it is easy to
  74. * test the pass-by-reference code paths on 64-bit platforms.
  75. *
  76. * Changing this requires an initdb.
  77. */
  78. #if SIZEOF_VOID_P >= 8
  79. #define USE_FLOAT8_BYVAL 1
  80. #endif
  81. /*
  82. * When we don't have native spinlocks, we use semaphores to simulate them.
  83. * Decreasing this value reduces consumption of OS resources; increasing it
  84. * may improve performance, but supplying a real spinlock implementation is
  85. * probably far better.
  86. */
  87. #define NUM_SPINLOCK_SEMAPHORES 128
  88. /*
  89. * When we have neither spinlocks nor atomic operations support we're
  90. * implementing atomic operations on top of spinlock on top of semaphores. To
  91. * be safe against atomic operations while holding a spinlock separate
  92. * semaphores have to be used.
  93. */
  94. #define NUM_ATOMICS_SEMAPHORES 64
  95. /*
  96. * MAXPGPATH: standard size of a pathname buffer in PostgreSQL (hence,
  97. * maximum usable pathname length is one less).
  98. *
  99. * We'd use a standard system header symbol for this, if there weren't
  100. * so many to choose from: MAXPATHLEN, MAX_PATH, PATH_MAX are all
  101. * defined by different "standards", and often have different values
  102. * on the same platform! So we just punt and use a reasonably
  103. * generous setting here.
  104. */
  105. #define MAXPGPATH 1024
  106. /*
  107. * PG_SOMAXCONN: maximum accept-queue length limit passed to
  108. * listen(2). You'd think we should use SOMAXCONN from
  109. * <sys/socket.h>, but on many systems that symbol is much smaller
  110. * than the kernel's actual limit. In any case, this symbol need be
  111. * twiddled only if you have a kernel that refuses large limit values,
  112. * rather than silently reducing the value to what it can handle
  113. * (which is what most if not all Unixen do).
  114. */
  115. #define PG_SOMAXCONN 10000
  116. /*
  117. * You can try changing this if you have a machine with bytes of
  118. * another size, but no guarantee...
  119. */
  120. #define BITS_PER_BYTE 8
  121. /*
  122. * Preferred alignment for disk I/O buffers. On some CPUs, copies between
  123. * user space and kernel space are significantly faster if the user buffer
  124. * is aligned on a larger-than-MAXALIGN boundary. Ideally this should be
  125. * a platform-dependent value, but for now we just hard-wire it.
  126. */
  127. #define ALIGNOF_BUFFER 32
  128. /*
  129. * If EXEC_BACKEND is defined, the postmaster uses an alternative method for
  130. * starting subprocesses: Instead of simply using fork(), as is standard on
  131. * Unix platforms, it uses fork()+exec() or something equivalent on Windows,
  132. * as well as lots of extra code to bring the required global state to those
  133. * new processes. This must be enabled on Windows (because there is no
  134. * fork()). On other platforms, it's only useful for verifying those
  135. * otherwise Windows-specific code paths.
  136. */
  137. #if defined(WIN32) && !defined(__CYGWIN__)
  138. #define EXEC_BACKEND
  139. #endif
  140. /*
  141. * Define this if your operating system supports link()
  142. */
  143. #if !defined(WIN32) && !defined(__CYGWIN__)
  144. #define HAVE_WORKING_LINK 1
  145. #endif
  146. /*
  147. * USE_POSIX_FADVISE controls whether Postgres will attempt to use the
  148. * posix_fadvise() kernel call. Usually the automatic configure tests are
  149. * sufficient, but some older Linux distributions had broken versions of
  150. * posix_fadvise(). If necessary you can remove the #define here.
  151. */
  152. #if HAVE_DECL_POSIX_FADVISE && defined(HAVE_POSIX_FADVISE)
  153. #define USE_POSIX_FADVISE
  154. #endif
  155. /*
  156. * USE_PREFETCH code should be compiled only if we have a way to implement
  157. * prefetching. (This is decoupled from USE_POSIX_FADVISE because there
  158. * might in future be support for alternative low-level prefetch APIs.
  159. * If you change this, you probably need to adjust the error message in
  160. * check_effective_io_concurrency.)
  161. */
  162. #ifdef USE_POSIX_FADVISE
  163. #define USE_PREFETCH
  164. #endif
  165. /*
  166. * Default and maximum values for backend_flush_after, bgwriter_flush_after
  167. * and checkpoint_flush_after; measured in blocks. Currently, these are
  168. * enabled by default if sync_file_range() exists, ie, only on Linux. Perhaps
  169. * we could also enable by default if we have mmap and msync(MS_ASYNC)?
  170. */
  171. #ifdef HAVE_SYNC_FILE_RANGE
  172. #define DEFAULT_BACKEND_FLUSH_AFTER 0 /* never enabled by default */
  173. #define DEFAULT_BGWRITER_FLUSH_AFTER 64
  174. #define DEFAULT_CHECKPOINT_FLUSH_AFTER 32
  175. #else
  176. #define DEFAULT_BACKEND_FLUSH_AFTER 0
  177. #define DEFAULT_BGWRITER_FLUSH_AFTER 0
  178. #define DEFAULT_CHECKPOINT_FLUSH_AFTER 0
  179. #endif
  180. /* upper limit for all three variables */
  181. #define WRITEBACK_MAX_PENDING_FLUSHES 256
  182. /*
  183. * USE_SSL code should be compiled only when compiling with an SSL
  184. * implementation.
  185. */
  186. #ifdef USE_OPENSSL
  187. #define USE_SSL
  188. #endif
  189. /*
  190. * This is the default directory in which AF_UNIX socket files are
  191. * placed. Caution: changing this risks breaking your existing client
  192. * applications, which are likely to continue to look in the old
  193. * directory. But if you just hate the idea of sockets in /tmp,
  194. * here's where to twiddle it. You can also override this at runtime
  195. * with the postmaster's -k switch.
  196. *
  197. * If set to an empty string, then AF_UNIX sockets are not used by default: A
  198. * server will not create an AF_UNIX socket unless the run-time configuration
  199. * is changed, a client will connect via TCP/IP by default and will only use
  200. * an AF_UNIX socket if one is explicitly specified.
  201. *
  202. * This is done by default on Windows because there is no good standard
  203. * location for AF_UNIX sockets and many installations on Windows don't
  204. * support them yet.
  205. */
  206. #ifndef WIN32
  207. #define DEFAULT_PGSOCKET_DIR "/tmp"
  208. #else
  209. #define DEFAULT_PGSOCKET_DIR ""
  210. #endif
  211. /*
  212. * This is the default event source for Windows event log.
  213. */
  214. #define DEFAULT_EVENT_SOURCE "PostgreSQL"
  215. /*
  216. * On PPC machines, decide whether to use the mutex hint bit in LWARX
  217. * instructions. Setting the hint bit will slightly improve spinlock
  218. * performance on POWER6 and later machines, but does nothing before that,
  219. * and will result in illegal-instruction failures on some pre-POWER4
  220. * machines. By default we use the hint bit when building for 64-bit PPC,
  221. * which should be safe in nearly all cases. You might want to override
  222. * this if you are building 32-bit code for a known-recent PPC machine.
  223. */
  224. #ifdef HAVE_PPC_LWARX_MUTEX_HINT /* must have assembler support in any case */
  225. #if defined(__ppc64__) || defined(__powerpc64__)
  226. #define USE_PPC_LWARX_MUTEX_HINT
  227. #endif
  228. #endif
  229. /*
  230. * On PPC machines, decide whether to use LWSYNC instructions in place of
  231. * ISYNC and SYNC. This provides slightly better performance, but will
  232. * result in illegal-instruction failures on some pre-POWER4 machines.
  233. * By default we use LWSYNC when building for 64-bit PPC, which should be
  234. * safe in nearly all cases.
  235. */
  236. #if defined(__ppc64__) || defined(__powerpc64__)
  237. #define USE_PPC_LWSYNC
  238. #endif
  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. * The following symbols are for enabling debugging code, not for
  252. * controlling user-visible features or resource limits.
  253. *------------------------------------------------------------------------
  254. */
  255. /*
  256. * Include Valgrind "client requests", mostly in the memory allocator, so
  257. * Valgrind understands PostgreSQL memory contexts. This permits detecting
  258. * memory errors that Valgrind would not detect on a vanilla build. It also
  259. * enables detection of buffer accesses that take place without holding a
  260. * buffer pin (or without holding a buffer lock in the case of index access
  261. * methods that superimpose their own custom client requests on top of the
  262. * generic bufmgr.c requests).
  263. *
  264. * "make installcheck" is significantly slower under Valgrind. The client
  265. * requests fall in hot code paths, so USE_VALGRIND slows execution by a few
  266. * percentage points even when not run under Valgrind.
  267. *
  268. * Do not try to test the server under Valgrind without having built the
  269. * server with USE_VALGRIND; else you will get false positives from sinval
  270. * messaging (see comments in AddCatcacheInvalidationMessage). It's also
  271. * important to use the suppression file src/tools/valgrind.supp to
  272. * exclude other known false positives.
  273. *
  274. * You should normally use MEMORY_CONTEXT_CHECKING with USE_VALGRIND;
  275. * instrumentation of repalloc() is inferior without it.
  276. */
  277. /* #define USE_VALGRIND */
  278. /*
  279. * Define this to cause pfree()'d memory to be cleared immediately, to
  280. * facilitate catching bugs that refer to already-freed values.
  281. * Right now, this gets defined automatically if --enable-cassert.
  282. */
  283. #ifdef USE_ASSERT_CHECKING
  284. #define CLOBBER_FREED_MEMORY
  285. #endif
  286. /*
  287. * Define this to check memory allocation errors (scribbling on more
  288. * bytes than were allocated). Right now, this gets defined
  289. * automatically if --enable-cassert or USE_VALGRIND.
  290. */
  291. #if defined(USE_ASSERT_CHECKING) || defined(USE_VALGRIND)
  292. #define MEMORY_CONTEXT_CHECKING
  293. #endif
  294. /*
  295. * Define this to cause palloc()'d memory to be filled with random data, to
  296. * facilitate catching code that depends on the contents of uninitialized
  297. * memory. Caution: this is horrendously expensive.
  298. */
  299. /* #define RANDOMIZE_ALLOCATED_MEMORY */
  300. /*
  301. * For cache-invalidation debugging, define DISCARD_CACHES_ENABLED to enable
  302. * use of the debug_discard_caches GUC to aggressively flush syscache/relcache
  303. * entries whenever it's possible to deliver invalidations. See
  304. * AcceptInvalidationMessages() in src/backend/utils/cache/inval.c for
  305. * details.
  306. *
  307. * USE_ASSERT_CHECKING builds default to enabling this. It's possible to use
  308. * DISCARD_CACHES_ENABLED without a cassert build and the implied
  309. * CLOBBER_FREED_MEMORY and MEMORY_CONTEXT_CHECKING options, but it's unlikely
  310. * to be as effective at identifying problems.
  311. */
  312. /* #define DISCARD_CACHES_ENABLED */
  313. #if defined(USE_ASSERT_CHECKING) && !defined(DISCARD_CACHES_ENABLED)
  314. #define DISCARD_CACHES_ENABLED
  315. #endif
  316. /*
  317. * Backwards compatibility for the older compile-time-only clobber-cache
  318. * macros.
  319. */
  320. #if !defined(DISCARD_CACHES_ENABLED) && (defined(CLOBBER_CACHE_ALWAYS) || defined(CLOBBER_CACHE_RECURSIVELY))
  321. #define DISCARD_CACHES_ENABLED
  322. #endif
  323. /*
  324. * Recover memory used for relcache entries when invalidated. See
  325. * RelationBuildDescr() in src/backend/utils/cache/relcache.c.
  326. *
  327. * This is active automatically for clobber-cache builds when clobbering is
  328. * active, but can be overridden here by explicitly defining
  329. * RECOVER_RELATION_BUILD_MEMORY. Define to 1 to always free relation cache
  330. * memory even when clobber is off, or to 0 to never free relation cache
  331. * memory even when clobbering is on.
  332. */
  333. /* #define RECOVER_RELATION_BUILD_MEMORY 0 */ /* Force disable */
  334. /* #define RECOVER_RELATION_BUILD_MEMORY 1 */ /* Force enable */
  335. /*
  336. * Define this to force all parse and plan trees to be passed through
  337. * copyObject(), to facilitate catching errors and omissions in
  338. * copyObject().
  339. */
  340. /* #define COPY_PARSE_PLAN_TREES */
  341. /*
  342. * Define this to force all parse and plan trees to be passed through
  343. * outfuncs.c/readfuncs.c, to facilitate catching errors and omissions in
  344. * those modules.
  345. */
  346. /* #define WRITE_READ_PARSE_PLAN_TREES */
  347. /*
  348. * Define this to force all raw parse trees for DML statements to be scanned
  349. * by raw_expression_tree_walker(), to facilitate catching errors and
  350. * omissions in that function.
  351. */
  352. /* #define RAW_EXPRESSION_COVERAGE_TEST */
  353. /*
  354. * Enable debugging print statements for lock-related operations.
  355. */
  356. /* #define LOCK_DEBUG */
  357. /*
  358. * Enable debugging print statements for WAL-related operations; see
  359. * also the wal_debug GUC var.
  360. */
  361. /* #define WAL_DEBUG */
  362. /*
  363. * Enable tracing of resource consumption during sort operations;
  364. * see also the trace_sort GUC var. For 8.1 this is enabled by default.
  365. */
  366. #define TRACE_SORT 1
  367. /*
  368. * Enable tracing of syncscan operations (see also the trace_syncscan GUC var).
  369. */
  370. /* #define TRACE_SYNCSCAN */