| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | David Mullineux <dmullx(at)gmail(dot)com> |
| Cc: | Postgres General <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Why analyze reports 30000 pages and rows scanned. Why not just rows? |
| Date: | 2025-08-19 14:40:47 |
| Message-ID: | 576573.1755614447@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
David Mullineux <dmullx(at)gmail(dot)com> 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Laurenz Albe | 2025-08-19 15:16:12 | Re: analyze-in-stages post upgrade questions |
| Previous Message | Fujii Masao | 2025-08-19 14:40:05 | Re: analyze-in-stages post upgrade questions |