Re: old_snapshot_threshold bottleneck on replica

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Maxim Orlov <orlovmg(at)gmail(dot)com>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: old_snapshot_threshold bottleneck on replica
Date: 2023-01-24 15:46:28
Message-ID: CA+TgmoboYmfYMnqtWgyE_1Jy9DYE_VE8HYiX3f1EoO=Wpx2VOQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jan 23, 2023 at 9:40 AM Maxim Orlov <orlovmg(at)gmail(dot)com> wrote:
> One of our customers stumble onto a significant performance degradation while running multiple OLAP-like queries on a replica.
> After some investigation, it became clear that the problem is in accessing old_snapshot_threshold parameter.

It has been suggested that we remove that feature entirely.

> My proposal is to use atomic for threshold_timestamp and threshold_xid. PFA 0001 patch.

This patch changes threshold_timestamp and threshold_xid to use
atomics, but it does not remove mutex_threshold which, according to a
quick glance at the comments, protects exactly those two fields. So,
either:

(1) that mutex also protects something else and the existing comment
is wrong, or

(2) the mutex should have been removed but the patch neglected to do so, or

(3) the mutex is still needed for some reason, in which case either
(3a) the patch isn't actually safe or (3b) the patch needs comments to
explain what the new synchronization model is.

--
Robert Haas
EDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message gkokolatos 2023-01-24 15:56:20 Re: Add LZ4 compression in pg_dump
Previous Message Tom Lane 2023-01-24 15:33:35 Re: pgindent vs variable declaration across multiple lines