pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Christophe Pettus <xof@thebuild.com>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: MultiXactMemberControlLock contention on a replica
Date: Tue, 16 Feb 2021 04:40:08 +0100
Message-ID: <e2cb31b1e243222ca93bd85763467690033afd0a.camel@cybertec.at> (raw)
In-Reply-To: <B75597DB-CBE0-4C39-9D6D-56EA1A250A45@thebuild.com>
References: <76AD9A74-E518-4D2F-A4B7-EBB6203530C3@thebuild.com>
	<99c0f12af81e0370c2caddb75cd8150a1a818dd8.camel@cybertec.at>
	<061BEE02-EA45-4ED5-A9CB-2015D133CA2B@thebuild.com>
	<d989eeec7ed83ff72cee294d049d21f8ea4347a6.camel@cybertec.at>
	<B75597DB-CBE0-4C39-9D6D-56EA1A250A45@thebuild.com>

On Mon, 2021-02-15 at 12:40 -0800, Christophe Pettus wrote:
> > On Feb 15, 2021, at 08:15, Laurenz Albe <laurenz.albe@cybertec.at> wrote:
> > Right.  I cannot think of any other reason, given that the standby only
> > allows reading.  It's just an "xmax", and PostgreSQL needs to read the
> > multixact to figure out if it can see the row or not.
> 
> 
> OK, I think I see the scenario: A very large number of sessions on the primary all
>  touch or create rows which refer to a particular row in another table by foreign
>  key, but they don't modify that row.  A lot of sessions on the secondary all read
>  the row in the referred-to table, so it has to get all the members of the multixact,
>  and if the multixact structure has spilled to disk, that gets very expensive.

You also get a multixact if you run something like

BEGIN;
SELECT ... FROM tab WHERE id = 42 FOR UPDATE;
SAVEPOINT a;
UPDATE tab SET ... WHERE id = 42;
ROLLBACK;

The multixact is also created if you commit, but it won't be visible.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com






view thread (6+ messages)

Message-ID: <e2cb31b1e243222ca93bd85763467690033afd0a.camel@cybertec.at>
Permalink:  ../e2cb31b1e243222ca93bd85763467690033afd0a.camel@cybertec.at/
Also on:    postgresql.org/message-id/e2cb31b1e243222ca93bd85763467690033afd0a.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: laurenz.albe@cybertec.at, xof@thebuild.com
  Subject: Re: MultiXactMemberControlLock contention on a replica
  In-Reply-To: <e2cb31b1e243222ca93bd85763467690033afd0a.camel@cybertec.at>
  References: <76AD9A74-E518-4D2F-A4B7-EBB6203530C3@thebuild.com> <99c0f12af81e0370c2caddb75cd8150a1a818dd8.camel@cybertec.at> <061BEE02-EA45-4ED5-A9CB-2015D133CA2B@thebuild.com> <d989eeec7ed83ff72cee294d049d21f8ea4347a6.camel@cybertec.at> <B75597DB-CBE0-4C39-9D6D-56EA1A250A45@thebuild.com> <e2cb31b1e243222ca93bd85763467690033afd0a.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox