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)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Christophe Pettus <xof(at)thebuild(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Dimitrios Apostolou <jimis(at)gmx(dot)net>, pgsql-general(at)lists(dot)postgresql(dot)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)
Date: 2023-02-01 18:56:02
Message-ID: 1402526.1675277762@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Christophe Pettus <xof(at)thebuild(dot)com> writes:
>> On Feb 1, 2023, at 10:45, David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>> The system just isn't that intelligent for "sequential scan", instead it 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 marked 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2023-02-01 20:00:28 "SELECT FROM foo" acts like "SELECT COUNT(*) FROM foo"?
Previous Message Adrian Klaver 2023-02-01 18:53:19 Re: Best Open Source OS for Postgresql