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 1kFelj-0007ud-1U for pgsql-general@arkaria.postgresql.org; Tue, 08 Sep 2020 14:38:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kFelh-0007t1-8Y for pgsql-general@arkaria.postgresql.org; Tue, 08 Sep 2020 14:38:45 +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 1kFelh-0007su-1A for pgsql-general@lists.postgresql.org; Tue, 08 Sep 2020 14:38:45 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kFele-0008DU-VE for pgsql-general@postgresql.org; Tue, 08 Sep 2020 14:38:44 +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 088EceXS1766634; Tue, 8 Sep 2020 10:38:40 -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> Comments: In-reply-to Magnus Hagander message dated "Tue, 08 Sep 2020 16:17:37 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1766632.1599575920.1@sss.pgh.pa.us> Date: Tue, 08 Sep 2020 10:38:40 -0400 Message-ID: <1766633.1599575920@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Magnus Hagander writes: > Oh sure, but there is clearly *something* going on, so we should try to > figure that out. Because a transaction running multiple independent selects > with the defaults settings will not actually block autovacuum. I don't think the OP is claiming that autovacuum is blocked, only that it's failing to remove recently-dead rows that he thinks could be removed. 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. There are some approximations involved in figuring out which rows are potentially still visible to someone. So perhaps this is a situation where an approximation is being used and tighter analysis would have shown that indeed a row could be removed. But we haven't seen any evidence of that so far. The basic fact that A's snapshot is limiting removal of rows from a table it has not touched is not a bug. regards, tom lane