gooderp18绿色标准版
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

39 lines
4.7KB

  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>14.5. Non-Durable Settings</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="prev" href="populate.html" title="14.4. Populating a Database" /><link rel="next" href="parallel-query.html" title="Chapter 15. Parallel Query" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">14.5. Non-Durable Settings</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="populate.html" title="14.4. Populating a Database">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="performance-tips.html" title="Chapter 14. Performance Tips">Up</a></td><th width="60%" align="center">Chapter 14. Performance Tips</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 12.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="parallel-query.html" title="Chapter 15. Parallel Query">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="NON-DURABILITY"><div class="titlepage"><div><div><h2 class="title" style="clear: both">14.5. Non-Durable Settings</h2></div></div></div><a id="id-1.5.13.8.2" class="indexterm"></a><p>
  3. Durability is a database feature that guarantees the recording of
  4. committed transactions even if the server crashes or loses
  5. power. However, durability adds significant database overhead,
  6. so if your site does not require such a guarantee,
  7. <span class="productname">PostgreSQL</span> can be configured to run
  8. much faster. The following are configuration changes you can make
  9. to improve performance in such cases. Except as noted below, durability
  10. is still guaranteed in case of a crash of the database software;
  11. only abrupt operating system stoppage creates a risk of data loss
  12. or corruption when these settings are used.
  13. </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
  14. Place the database cluster's data directory in a memory-backed
  15. file system (i.e. <acronym class="acronym">RAM</acronym> disk). This eliminates all
  16. database disk I/O, but limits data storage to the amount of
  17. available memory (and perhaps swap).
  18. </p></li><li class="listitem"><p>
  19. Turn off <a class="xref" href="runtime-config-wal.html#GUC-FSYNC">fsync</a>; there is no need to flush
  20. data to disk.
  21. </p></li><li class="listitem"><p>
  22. Turn off <a class="xref" href="runtime-config-wal.html#GUC-SYNCHRONOUS-COMMIT">synchronous_commit</a>; there might be no
  23. need to force <acronym class="acronym">WAL</acronym> writes to disk on every
  24. commit. This setting does risk transaction loss (though not data
  25. corruption) in case of a crash of the <span class="emphasis"><em>database</em></span>.
  26. </p></li><li class="listitem"><p>
  27. Turn off <a class="xref" href="runtime-config-wal.html#GUC-FULL-PAGE-WRITES">full_page_writes</a>; there is no need
  28. to guard against partial page writes.
  29. </p></li><li class="listitem"><p>
  30. Increase <a class="xref" href="runtime-config-wal.html#GUC-MAX-WAL-SIZE">max_wal_size</a> and <a class="xref" href="runtime-config-wal.html#GUC-CHECKPOINT-TIMEOUT">checkpoint_timeout</a>; this reduces the frequency
  31. of checkpoints, but increases the storage requirements of
  32. <code class="filename">/pg_wal</code>.
  33. </p></li><li class="listitem"><p>
  34. Create <a class="link" href="sql-createtable.html#SQL-CREATETABLE-UNLOGGED">unlogged
  35. tables</a> to avoid <acronym class="acronym">WAL</acronym> writes, though it
  36. makes the tables non-crash-safe.
  37. </p></li></ul></div><p>
  38. </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="populate.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="performance-tips.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="parallel-query.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">14.4. Populating a Database </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 15. Parallel Query</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1