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 1pNIHF-0005XB-QH for pgsql-general@arkaria.postgresql.org; Wed, 01 Feb 2023 18:56:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pNIHE-0005yy-Db for pgsql-general@arkaria.postgresql.org; Wed, 01 Feb 2023 18:56:12 +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 1pNIHE-0005yj-3D for pgsql-general@lists.postgresql.org; Wed, 01 Feb 2023 18:56:12 +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 1pNIH9-0005za-FR for pgsql-general@lists.postgresql.org; Wed, 01 Feb 2023 18:56:11 +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 311Iu2sl1402527; Wed, 1 Feb 2023 13:56:02 -0500 From: Tom Lane To: Christophe Pettus cc: "David G. Johnston" , Dimitrios Apostolou , pgsql-general@lists.postgresql.org Subject: Re: VACUUM vs VACUUM FULL (was: SELECT * FROM huge_table LIMIT 10; Why does it take more than 10 min to complete, with cold caches) In-reply-to: <01D1B408-EADC-41C7-A695-7C84F649F702@thebuild.com> References: <0c18ab4b-b8fd-ac03-2118-066fe0362246@gmx.net> <01D1B408-EADC-41C7-A695-7C84F649F702@thebuild.com> Comments: In-reply-to Christophe Pettus message dated "Wed, 01 Feb 2023 10:47:17 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1402525.1675277762.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 01 Feb 2023 13:56:02 -0500 Message-ID: <1402526.1675277762@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Christophe Pettus writes: >> On Feb 1, 2023, at 10:45, David G. Johnston wrote: >> The system just isn't that intelligent for "sequential scan", instead i= t does literally what the label says, goes through the table one page at a= time and returns any live rows it finds. = > Although this does raise a question: Couldn't it skip pages that are mar= ked appropriately in the visibility map? There's no bit in the visibility map for "contains no live tuples". I think adding one would be optimizing for the wrong thing. (You might be thinking of the free-space map, but we don't maintain that rigorously enough to trust it as a guide to skipping pages.) regards, tom lane