pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Sai Sadashiva Kundurmutt <saisadashiva2000@gmail.com>
Cc: pgsql-admin@lists.postgresql.org
Subject: Re: Are the estimates made for number of pages accurate
Date: Sun, 25 Feb 2024 11:41:54 -0500
Message-ID: <1503697.1708879314@sss.pgh.pa.us> (raw)
In-Reply-To: <CAH6hFGLT-58qZfPQRkOEt52qrU9iM-pw3DLi8UhwRsm7dO-V0g@mail.gmail.com>
References: <CAH6hFGLT-58qZfPQRkOEt52qrU9iM-pw3DLi8UhwRsm7dO-V0g@mail.gmail.com>

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





view thread (3+ messages)  latest in thread

Message-ID: <1503697.1708879314@sss.pgh.pa.us>
Permalink:  ../1503697.1708879314@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1503697.1708879314@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, saisadashiva2000@gmail.com, pgsql-admin@lists.postgresql.org
  Subject: Re: Are the estimates made for number of pages accurate
  In-Reply-To: <1503697.1708879314@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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