public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: David Mullineux <[email protected]>
Cc: Postgres General <[email protected]>
Subject: Re: Why analyze reports 30000 pages and rows scanned. Why not just rows?
Date: Tue, 19 Aug 2025 10:40:47 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAGsyd8UWZr3DiAxTgZqnsJU_LipoL9fhyForcC=B8tzxwEyPLw@mail.gmail.com>
References: <CAGsyd8UWZr3DiAxTgZqnsJU_LipoL9fhyForcC=B8tzxwEyPLw@mail.gmail.com>

David Mullineux <[email protected]> writes:
> But my question is, why does 'analyze verbose' report that it has scanned
> '30000 of NNNN pages, containing NNNN live rows and 0 dead rows; 30000 rows
> in sample,....'

> As most tables would store more than 1 row per page, I expected that 30000
> rows would require a lot fewer than 30000 *pages* to be scanned.  Why is it
> saying it's scanned 30000 pages instead of only 30000 rows ?

If the table is sufficiently large, taking a sample of a single row
from each of 30000 different pages is the correct behavior.  Taking
more than one row from each of a smaller set of pages would give a
nonrandom (because clumped) sample.

			regards, tom lane






view thread (2+ messages)

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: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Why analyze reports 30000 pages and rows scanned. Why not just rows?
  In-Reply-To: <[email protected]>

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

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox