]> begriffs open source - ai-pg/blob - full-docs/txt/non-durability.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / non-durability.txt
1
2 14.5. Non-Durable Settings #
3
4    Durability is a database feature that guarantees the recording of
5    committed transactions even if the server crashes or loses power.
6    However, durability adds significant database overhead, so if your site
7    does not require such a guarantee, PostgreSQL can be configured to run
8    much faster. The following are configuration changes you can make to
9    improve performance in such cases. Except as noted below, durability is
10    still guaranteed in case of a crash of the database software; only an
11    abrupt operating system crash creates a risk of data loss or corruption
12    when these settings are used.
13      * Place the database cluster's data directory in a memory-backed file
14        system (i.e., RAM disk). This eliminates all database disk I/O, but
15        limits data storage to the amount of available memory (and perhaps
16        swap).
17      * Turn off fsync; there is no need to flush data to disk.
18      * Turn off synchronous_commit; there might be no need to force WAL
19        writes to disk on every commit. This setting does risk transaction
20        loss (though not data corruption) in case of a crash of the
21        database.
22      * Turn off full_page_writes; there is no need to guard against
23        partial page writes.
24      * Increase max_wal_size and checkpoint_timeout; this reduces the
25        frequency of checkpoints, but increases the storage requirements of
26        /pg_wal.
27      * Create unlogged tables to avoid WAL writes, though it makes the
28        tables non-crash-safe.