Re: Are the estimates made for number of pages accurate - Mailing list pgsql-admin

From Tom Lane
Subject Re: Are the estimates made for number of pages accurate
Date
Msg-id 1503697.1708879314@sss.pgh.pa.us
Whole thread Raw
In response to Are the estimates made for number of pages accurate  (Sai Sadashiva Kundurmutt <saisadashiva2000@gmail.com>)
Responses Re: Are the estimates made for number of pages accurate
List pgsql-admin
Sai Sadashiva Kundurmutt <saisadashiva2000@gmail.com> writes:
> I wanted to know whether the numbers calculated by ANALYZE for number of
> pages are exact(the relpages field in pg_class).

If memory serves, relpages is accurate as of the time of the last
VACUUM or ANALYZE on the table, but of course it could be arbitrarily
out of date later.

> I had the impression that
> it is exact  because during random sampling the number of pages is assumed
> to be known.

What makes you think that?  And even more to the point, what makes
you think that we'd rely on relpages for such a purpose?  I'd expect
a fresh RelationGetNumberOfBlocks call in any scan that had a need
to know the table size.

            regards, tom lane



pgsql-admin by date:

Previous
From: Sai Sadashiva Kundurmutt
Date:
Subject: Are the estimates made for number of pages accurate
Next
From: Ron Johnson
Date:
Subject: Re: Another way to do audit in DML operations in PostgreSQL >= 14