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 1kFfLq-0000zP-2q for pgsql-general@arkaria.postgresql.org; Tue, 08 Sep 2020 15:16:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kFfLo-0004gH-SB for pgsql-general@arkaria.postgresql.org; Tue, 08 Sep 2020 15:16:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kFfLo-0004g9-Kj for pgsql-general@lists.postgresql.org; Tue, 08 Sep 2020 15:16:04 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kFfLm-0008O8-5F for pgsql-general@postgresql.org; Tue, 08 Sep 2020 15:16:04 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 088FFwnU1768410; Tue, 8 Sep 2020 11:15:58 -0400 From: Tom Lane To: Magnus Hagander cc: Michael Holzman , pgsql-general General Subject: Re: Autovacuum of independent tables In-reply-to: References: <20200908082755.GI19261@paquier.xyz> <1766633.1599575920@sss.pgh.pa.us> Comments: In-reply-to Magnus Hagander message dated "Tue, 08 Sep 2020 16:46:56 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1768408.1599578158.1@sss.pgh.pa.us> Date: Tue, 08 Sep 2020 11:15:58 -0400 Message-ID: <1768409.1599578158@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Magnus Hagander writes: > On Tue, Sep 8, 2020 at 4:38 PM Tom Lane wrote: >> The reason that's not so is that whether or not transaction A *has* >> touched table B is irrelevant. It *could* read table B at any moment, >> for all autovacuum knows. Therefore we cannot remove rows that should >> still be visible to A's snapshot. > Right. But in the default isolation level, the snapshot of A gets reset > between each SELECT, and does not persist to the end of the transaction. Well, we don't know what isolation level the OP is using. We also don't know what PG version he's using. From memory, it hasn't been that long since we fixed things so that an idle read-committed transaction advertises no xmin. It's also possible that the transaction isn't really idle between statements (eg, if it's holding open cursors, or the like). regards, tom lane