14.5. Non-Durable Settings

|14.5. Non-Durable Settings|                           |                            |                  |                            |
|:------------------------:|---------------------------|----------------------------|------------------|----------------------------|
|  [Prev](populate.html)   |[Up](performance-tips.html)|Chapter 14. Performance Tips|[Home](index.html)| [Next](parallel-query.html)|

---

## 14.5. Non-Durable Settings

[]()

 Durability is a database feature that guarantees the recording of committed transactions even if the server crashes or loses power. However, durability adds significant database overhead, so if your site does not require such a guarantee, PostgreSQL can be configured to run much faster. The following are configuration changes you can make to improve performance in such cases. Except as noted below, durability is still guaranteed in case of a crash of the database software; only an abrupt operating system crash creates a risk of data loss or corruption when these settings are used.

* Place the database cluster's data directory in a memory-backed file system (i.e., RAM disk). This eliminates all database disk I/O, but limits data storage to the amount of available memory (and perhaps swap).

* Turn off [fsync](runtime-config-wal.html#GUC-FSYNC); there is no need to flush data to disk.

* Turn off [synchronous\_commit](runtime-config-wal.html#GUC-SYNCHRONOUS-COMMIT); there might be no need to force WAL writes to disk on every commit. This setting does risk transaction loss (though not data corruption) in case of a crash of the *database*.

* Turn off [full\_page\_writes](runtime-config-wal.html#GUC-FULL-PAGE-WRITES); there is no need to guard against partial page writes.

* Increase [max\_wal\_size](runtime-config-wal.html#GUC-MAX-WAL-SIZE) and [checkpoint\_timeout](runtime-config-wal.html#GUC-CHECKPOINT-TIMEOUT); this reduces the frequency of checkpoints, but increases the storage requirements of `/pg_wal`.

* Create [unlogged tables](sql-createtable.html#SQL-CREATETABLE-UNLOGGED) to avoid WAL writes, though it makes the tables non-crash-safe.

---

|   [Prev](populate.html)   |[Up](performance-tips.html)| [Next](parallel-query.html)|
|:--------------------------|:-------------------------:|---------------------------:|
|14.4. Populating a Database|    [Home](index.html)     | Chapter 15. Parallel Query |

 // \<![CDATA[ \<-- For SVG support if ('WebSocket' in window) { (function() { function refreshCSS() { var sheets = [].slice.call(document.getElementsByTagName("link")); var head = document.getElementsByTagName("head")[0]; for (var i = 0; i \< sheets.length; ++i) { var elem = sheets[i]; head.removeChild(elem); var rel = elem.rel; if (elem.href && typeof rel != "string" || rel.length == 0 || rel.toLowerCase() == "stylesheet") { var url = elem.href.replace(/(&|\\?)\_cacheOverride=\\d+/, ''); elem.href = url + (url.indexOf('?') \>= 0 ? '&' : '?') + '\_cacheOverride=' + (new Date().valueOf()); } head.appendChild(elem); } } var protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://'; var address = protocol + window.location.host + window.location.pathname + '/ws'; var socket = new WebSocket(address); socket.onmessage = function(msg) { if (msg.data == 'reload') window.location.reload(); else if (msg.data == 'refreshcss') refreshCSS(); }; console.log('Live reload enabled.'); })(); } // ]]\>