pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedAre the estimates made for number of pages accurate
3+ messages / 2 participants
[nested] [flat]
* Are the estimates made for number of pages accurate
@ 2024-02-25 08:40 Sai Sadashiva Kundurmutt <saisadashiva2000@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Sai Sadashiva Kundurmutt @ 2024-02-25 08:40 UTC (permalink / raw)
To: pgsql-admin@lists.postgresql.org
Hi,
I wanted to know whether the numbers calculated by ANALYZE for number of
pages are exact(the relpages field in pg_class). I had the impression that
it is exact because during random sampling the number of pages is assumed
to be known. Is this true ??
Thank you,
Warm regards,
Sai Sadashiva JK
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Are the estimates made for number of pages accurate
@ 2024-02-25 16:41 Tom Lane <tgl@sss.pgh.pa.us>
parent: Sai Sadashiva Kundurmutt <saisadashiva2000@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Tom Lane @ 2024-02-25 16:41 UTC (permalink / raw)
To: Sai Sadashiva Kundurmutt <saisadashiva2000@gmail.com>; +Cc: pgsql-admin@lists.postgresql.org
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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Are the estimates made for number of pages accurate
@ 2024-02-26 03:59 Sai Sadashiva Kundurmutt <saisadashiva2000@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 3+ messages in thread
From: Sai Sadashiva Kundurmutt @ 2024-02-26 03:59 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-admin@lists.postgresql.org
Thank you for clearing my doubts.
On Sun, 25 Feb 2024 at 22:11, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 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
>
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2024-02-26 03:59 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-02-25 08:40 Are the estimates made for number of pages accurate Sai Sadashiva Kundurmutt <saisadashiva2000@gmail.com>
2024-02-25 16:41 ` Tom Lane <tgl@sss.pgh.pa.us>
2024-02-26 03:59 ` Sai Sadashiva Kundurmutt <saisadashiva2000@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox