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 1nCx7g-0003W0-K0 for pgsql-general@arkaria.postgresql.org; Thu, 27 Jan 2022 05:15:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nCx7f-00070x-EE for pgsql-general@arkaria.postgresql.org; Thu, 27 Jan 2022 05:15:03 +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 1nCx7f-00070M-34 for pgsql-general@lists.postgresql.org; Thu, 27 Jan 2022 05:15:03 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nCx7c-00008m-TX for pgsql-general@postgresql.org; Thu, 27 Jan 2022 05:15:02 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id D581B5C0163; Thu, 27 Jan 2022 00:14:58 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Thu, 27 Jan 2022 00:14:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; bh=piZuMlBbNBSqMR2/umUJ8FtP6ARBSOeBFC0IJ6 /asQU=; b=AhboKHgzLZlW8aQ6UMEQTrq/m7FkDG5ACLZUPnKSs1TKPSWvtQSHfe 44Ax5hjS3OgCBSMBTZKL74Li0QOR8YcD1f5qGseUzC/I0iUSY2N6N4PoXEN1NC2j RZRFTxhTfpHVOirb7wde+c3YjeZDQ4YH4uHsqopiOI5Yq8/sqwVOqejEXCBPCXvX Dpnrh1XFtUgqF9X/+GNoKmQjY4R29uotevRiiBoakliBpRtRawPG9J5/VMKsc+Pz +smtXKQrmbBcC4kaZNCV42cMD9whw9BayRrjrgCu9cXIcRt/+t9huJrU1X9bjmS/ NFag5NHbV/4WO/q2rk6vx6jqgRSInwSg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=piZuMlBbNBSqMR2/u mUJ8FtP6ARBSOeBFC0IJ6/asQU=; b=VRJcEzx/4XXAeErjRecqQPhBsbIpDuCVz VqxTxLmjQQwzYcTsr9Q8jlGnGS23956DHYP+yGghGDRpK/eNbgjW650TmiOZoiMB NzupxaerL0SllrN2HgJD0BFvVj8N22/jSvwnzVeAtTFFs+u+wHbxYBXRjp7irBfU 8Df5aiIUy+Jdhs9eG2kAxKt5oh9XUScV7LbNKtlEA9PCZRMI5unRiiLD1u41deaV WmfsULXXBEnBHFmq6uq0agPw/r9wbfOcYVakHJz05rbS4TGEIavKZ3BgrOerdYiZ HTNapHvp9AMabMKrATW/QOoyKlOXDvTK1x2lTxDSWFS9VSWV8xr1g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrfedvgdektdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculdejtddmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttddu necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepvedtgfekudduueevteefgefgjedu vddtteeuhfelueffueekiefhjefgieegudelnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihii X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 27 Jan 2022 00:14:57 -0500 (EST) Date: Thu, 27 Jan 2022 14:14:55 +0900 From: Michael Paquier To: Ben Chobot Cc: pgsql-general Subject: Re: could not open relation with OID Message-ID: References: <93f68bda-97d2-9944-3e09-2045339b71ab@silentmedia.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="oPzSomoqm6Kxemsy" Content-Disposition: inline In-Reply-To: <93f68bda-97d2-9944-3e09-2045339b71ab@silentmedia.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --oPzSomoqm6Kxemsy Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jan 26, 2022 at 05:30:01PM -0800, Ben Chobot wrote: > We do a lot of queries per day, over a lot of hosts, all of which are on > 12.9. We've recently started doing a better job at analyzing our db logs = and > have found that, a few times a day, every day, we see some of our queries > fail with errors like: >=20 > could not open relation with OID 201940279 >=20 > In the cases we've examined so far, the failed query succeeds just fine w= hen > we run it manually. The failed query also had run on an async streaming > replica, and the primary has completed at least one autovacuum since the > failure. I don't know if either of those two facts are relevant, but I'm = not > sure what else to blame. The internet seems to want to blame issues like > this on temp tables, which makes sense, but in our case, most of the quer= ies > that are failing this way are simple PK scans, which then fall back to the > table to pull all the columns. The tables themselves are small in row cou= nt > - although some values are likely TOASTed - so I would be surprised if > anything is spilling to disk for sorting, which might have counted as a t= emp > table enough to give such an error. Do those OIDs point to some specific relations? It should be easy enough to guess to which pg_class entry they point to, especially if you have a persistent schema, and it these are indeed temporary entries or not depending on their pg_class.relnamespace. > This is a minuscule failure percentage, so replicating it is going to be > hard, but it is still breaking for reasons I don't understand, and so I'd > like to fix it. Has anybody else seen this, or have an ideas of what to l= ook > at? I don't recall seeing such reports recently. > Other things we've considered: > =A0=A0=A0 - we run pg_repack, which certainly seems like it could make an= error > like this, but we see this error in places and times that pg_repack isn't > currently running It could also take time for the issue to show up, depending on the state of the relcache. -- Michael --oPzSomoqm6Kxemsy Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmHyKk8ACgkQnvQgOdby QH2+0Q//RPZ6esiKd5xoqxKfWszUH+H0TTZDpkumoTOMMA1+4bOZZn4myObCIt/B LK8Enmi9dDLO3WcYre763PtxzIcjCv4y1+n0zII0Rl5tQk0Wdkl7hXpMd7r7MPWC joHuG1DouS7ecxreLysuT29oZp4Dq/i8dnXRYxFcCSWrdMapd631IOORcOdWeAt3 2S+jZogF5XOIq0PyQuPgNbHZZYHIdjiFrbGPvlQgUbheSiWlrFvoi1WT9Tkv9NoW mcp9xxdlbUWaTFVgDcNflEgF9CFgJycPXOW0PsKy8TkEkuweFqZc5dtGaqqMOcEJ UijoFrfxTDgDJLe7gks8HumgBjw61WiQTx6gh/jZBNK0f/mzXtHszUcpxamyW7CK BnuFANfVjYGv5LQ2B1fZfxFb2VGqY0vP8ulqyX+G8kP8CD0ZTSj9l/D1khNe/gYE 4VtvLvWTcJiaSvFY4iToWbFJAdiHqj8yeB+8QmfTaVPBhShEbT4928zdm2uvuMbg 8n+im+IKoJDxOGMUR/i61KVYqeDrf1z4LY1cN00+q8ui1r54CY/lQdzTQNi7d0ny NRTCy3rdlaVqyQCiGe0lF2R1ba1a6L8q3B5PGr9mxGvxossIhEWHHKNnWZ32erDK tXX7C7mCHmUf1j4/2a3YMpcAsS3h9Ec5LIof1pmtjaBNQe6Xh4Y= =cdJH -----END PGP SIGNATURE----- --oPzSomoqm6Kxemsy--