Mitigating impact of long running read-only queries

From: Michael Lewis <lewis(dot)michaelr(at)gmail(dot)com>
To: PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Mitigating impact of long running read-only queries
Date: 2020-12-14 14:41:11
Message-ID: CAMcsB=wKHM-PLWrYy8ZnQ95CitK5X-ZCv+pQWYy9TX5sDxJW=g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

https://www.postgresql.org/docs/current/sql-set-transaction.html

"The DEFERRABLE transaction property has no effect unless the transaction
is also SERIALIZABLE and READ ONLY. When all three of these properties are
selected for a transaction, the transaction may block when first acquiring
its snapshot, after which it is able to run without the normal overhead of
a SERIALIZABLE transaction and without any risk of contributing to or being
canceled by a serialization failure. This mode is well suited for
long-running reports or backups."

If I use these three properties together as below, would WAL buildup be
prevented, or will the system still be causing a backup of the WAL for
logical replication during the entire duration of my long reporting query?

BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE READ ONLY DEFERRABLE;
--long report query
commit;

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2020-12-14 14:56:47 Re: Dynamic procedure execution
Previous Message Thomas Kellerer 2020-12-14 11:47:47 Re: Improving performance of select query