Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lBrDo-0007Dk-Id for pgsql-general@arkaria.postgresql.org; Tue, 16 Feb 2021 03:40:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lBrDn-0003JP-HY for pgsql-general@arkaria.postgresql.org; Tue, 16 Feb 2021 03:40:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lBrDn-0003JI-9y for pgsql-general@lists.postgresql.org; Tue, 16 Feb 2021 03:40:19 +0000 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lBrDg-00049n-74 for pgsql-general@lists.postgresql.org; Tue, 16 Feb 2021 03:40:17 +0000 Received: by mail-ej1-x62c.google.com with SMTP id g5so10927694ejt.2 for ; Mon, 15 Feb 2021 19:40:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=jtOlGGWYBoDglrklCcHqdjSIoy4mWBDbITDIxr8Rhi4=; b=veDg86PDZ8RVmooW/tva9U72vQPP9/bMcKtqvbEzxIGSESyKHntMINV/Fv+fUKCUYX 5Se6yllXWPO2W/3Jw42wnBqRAauC2CN1/WW2N/gGv6Vpm/JTC2Rvn/zA8ih1/QuOjHrv su+DEnQ4li76ivv9OeDn+mavAWyOqkPjqChSDs67L1NH4gp6DoSwWx1EHb07Sf8nsEx6 iy5MBuMca3rn0UmOjEoTmaCP77/T7SvhMt3Z5XethR+J1dF2yX+QFexF2CPtgxd2AFza DPvvHuJZbHnIrRkseCODFoFmiVkmYDNf1RdBBfC7lnHkJNWqAKGDkDfuH2qkEcO/fPvW JJBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=jtOlGGWYBoDglrklCcHqdjSIoy4mWBDbITDIxr8Rhi4=; b=mXK0ozaq2PmbVV+AMrBn9j+5oup97FNCS4MwC0CGU4WTq0WCx64Afz1FE9ViuLeO18 v0HJGUdim3U2Ox5PYxIP8FnnTAJqo4JhCdzDVataxDALUFwrQjDrH1Xg7Ikrd40CuWI0 Uf/FV7OsOVjZnYI1qsCuQisTsgjWx1jc01rDiCONFaqPZD7dyGIa0m0v+gbzavEYNpX4 cwWVFvBr3nOowadVjPn0T51Zkq4+i0e5eM5Cs0uN27iCcYPtWdugdLHaaF+9v41iVlnm 2wEPPnFy/kzKZPlvWcK+Gf3fFR4faCTA96RBKh3xuHLho315I0DxFOTUNaZqutVk461r VusQ== X-Gm-Message-State: AOAM533Vx5CDrkn4rEJLww+fTlIlKyb/xfixq/eU5QHmiO79sUN8QGry xFIH6IvwOIbQI1+um3ySVhubtIrZ1FZY+A== X-Google-Smtp-Source: ABdhPJySor2BPaEvXnUU+g3sFcdb3ye+sqJZAlKEu2a6G1CTHR4kGe1Trf50JD/0cjccZTZlYRVcrg== X-Received: by 2002:a17:906:d18e:: with SMTP id c14mr18866031ejz.302.1613446809353; Mon, 15 Feb 2021 19:40:09 -0800 (PST) Received: from localhost.localdomain (178-190-180-133.adsl.highway.telekom.at. [178.190.180.133]) by smtp.gmail.com with ESMTPSA id u18sm12196135ejc.76.2021.02.15.19.40.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Feb 2021 19:40:09 -0800 (PST) Message-ID: Subject: Re: MultiXactMemberControlLock contention on a replica From: Laurenz Albe To: Christophe Pettus Cc: "pgsql-generallists.postgresql.org" Date: Tue, 16 Feb 2021 04:40:08 +0100 In-Reply-To: References: <76AD9A74-E518-4D2F-A4B7-EBB6203530C3@thebuild.com> <99c0f12af81e0370c2caddb75cd8150a1a818dd8.camel@cybertec.at> <061BEE02-EA45-4ED5-A9CB-2015D133CA2B@thebuild.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, 2021-02-15 at 12:40 -0800, Christophe Pettus wrote: > > On Feb 15, 2021, at 08:15, Laurenz Albe 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