From 0a6c9c66da26751322d90f75c872c350376cf55e Mon Sep 17 00:00:00 2001 From: Noah Misch Date: Sun, 22 Mar 2020 09:24:09 -0700 Subject: Revert "Skip WAL for new relfilenodes, under wal_level=minimal." This reverts commit cb2fd7eac285b1b0a24eeb2b8ed4456b66c5a09f. Per numerous buildfarm members, it was incompatible with parallel query, and a test case assumed LP64. Back-patch to 9.5 (all supported versions). Discussion: https://postgr.es/m/20200321224920.GB1763544@rfd.leadboat.com --- doc/src/sgml/config.sgml | 41 +++++++++-------------------------------- doc/src/sgml/perform.sgml | 47 ++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 47 insertions(+), 41 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 0d78c915f0e..6c00ec894d0 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -2234,19 +2234,16 @@ include_dir 'conf.d' levels. This parameter can only be set at server start. - In minimal level, no information is logged for - permanent relations for the remainder of a transaction that creates or - rewrites them. This can make operations much faster (see - ). Operations that initiate this - optimization include: + In minimal level, WAL-logging of some bulk + operations can be safely skipped, which can make those + operations much faster (see ). + Operations in which this optimization can be applied include: - ALTER ... SET TABLESPACE - CLUSTER - CREATE TABLE - REFRESH MATERIALIZED VIEW - (without ) - REINDEX - TRUNCATE + CREATE TABLE AS + CREATE INDEX + CLUSTER + COPY into tables that were created or truncated in the same + transaction But minimal WAL does not contain enough information to reconstruct the data from a base backup and the WAL logs, so replica or @@ -2635,26 +2632,6 @@ include_dir 'conf.d' - - wal_skip_threshold (integer) - - wal_skip_threshold configuration parameter - - - - - When wal_level is minimal and a - transaction commits after creating or rewriting a permanent relation, - this setting determines how to persist the new data. If the data is - smaller than this setting, write it to the WAL log; otherwise, use an - fsync of affected files. Depending on the properties of your storage, - raising or lowering this value might help if such commits are slowing - concurrent transactions. The default is two megabytes - (2MB). - - - - commit_delay (integer) diff --git a/doc/src/sgml/perform.sgml b/doc/src/sgml/perform.sgml index e13091d8f25..4dd3e35d0e5 100644 --- a/doc/src/sgml/perform.sgml +++ b/doc/src/sgml/perform.sgml @@ -1523,8 +1523,8 @@ SELECT * FROM x, y, a, b, c WHERE something AND somethingelse; needs to be written, because in case of an error, the files containing the newly loaded data will be removed anyway. However, this consideration only applies when - is minimal - as all commands must write WAL otherwise. + is minimal for + non-partitioned tables as all commands must write WAL otherwise. @@ -1624,13 +1624,42 @@ SELECT * FROM x, y, a, b, c WHERE something AND somethingelse; - Aside from avoiding the time for the archiver or WAL sender to process the - WAL data, doing this will actually make certain commands faster, because - they do not to write WAL at all if wal_level - is minimal and the current subtransaction (or top-level - transaction) created or truncated the table or index they change. (They - can guarantee crash safety more cheaply by doing - an fsync at the end than by writing WAL.) + Aside from avoiding the time for the archiver or WAL sender to + process the WAL data, + doing this will actually make certain commands faster, because they + are designed not to write WAL at all if wal_level + is minimal. (They can guarantee crash safety more cheaply + by doing an fsync at the end than by writing WAL.) + This applies to the following commands: + + + + CREATE TABLE AS SELECT + + + + + CREATE INDEX (and variants such as + ALTER TABLE ADD PRIMARY KEY) + + + + + ALTER TABLE SET TABLESPACE + + + + + CLUSTER + + + + + COPY FROM, when the target table has been + created or truncated earlier in the same transaction + + + -- cgit v1.2.3