Re: vacuumdb --analyze-only scans all pages?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Gerhard Wiesinger <lists(at)wiesinger(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: vacuumdb --analyze-only scans all pages?
Date: 2016-12-29 15:10:21
Message-ID: 19759.1483024221@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> writes:
> On 12/28/2016 11:54 PM, Gerhard Wiesinger wrote:
>> vacuumdb --analyze-only --all --verbose
>> INFO: analyzing "public.log"
>> INFO: "log": scanned 30000 of 30851 pages, containing 3599899 live rows
>> and 0 dead rows; 30000 rows in sample, 3702016 estimated total rows
>> INFO: analyzing "public.log_details"
>> INFO: "log_details": scanned 2133350 of 2133350 pages, containing
>> 334935843 live rows and 0 dead rows; 3000000 rows in sample, 334935843
>> estimated total rows
>> INFO: analyzing "public.log_details_str"
>> INFO: "log_details_str": scanned 30000 of 521126 pages, containing
>> 3601451 live rows and 0 dead rows; 30000 rows in sample, 62560215
>> estimated total rows
>>
>> Any ideas why?

> I would say because the '3000000 rows in sample' where spread out over
> all 2133350 pages.

Worth pointing out here is that you must have a custom statistics target
set on log_details to make it want a sample so much larger than the
default. If you feel ANALYZE is taking too long, you should reconsider
whether you need such a large target.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2016-12-29 15:33:35 Re: LYDB: What advice about stored procedures and other server side code?
Previous Message Adrian Klaver 2016-12-29 15:02:18 Re: vacuumdb --analyze-only scans all pages?