From: Julien Rouhaud <rjuju123@gmail.com>
To: Andrus <kobruleht2@hot.ee>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Why there is 30000 rows is sample
Date: Sat, 4 Apr 2020 09:28:51 +0200
Message-ID: <20200404072851.3w4xokdm5mlzkpos@nol> (raw)
In-Reply-To: <3D72D8D12557453AB3E0EB46FB911C17@dell2>
References: <3D72D8D12557453AB3E0EB46FB911C17@dell2>
Hi,
On Sat, Apr 04, 2020 at 10:07:51AM +0300, Andrus wrote:
> Hi!
>
> vacuumdb output:
>
> vacuumdb: vacuuming database "mydb"
> INFO: analyzing "public.mytable"
> INFO: "mytable": scanned 2709 of 2709 pages, containing 10834 live rows and
> 0 dead rows; 10834 rows in sample, 10834 estimated total rows
>
> For tables with more than 30000 rows, it shows that there are 30000 rows in sample.
>
> postgresql.conf does not set default_statistics_target value.
> It contains
>
> #default_statistics_target = 100 # range 1-10000
>
> So I expect that there should be 100 rows is sample.
> Why Postgres uses 30000 or number of rows in table for smaller tables ?
>
> Is 30000 some magical value, how to control it.
That's because default_statistics_target's unit isn't 1 row but 300 rows, so
yeah the 300 here is a little bit of a magical value.
You can see more details about this value at
https://github.com/postgres/postgres/blob/master/src/backend/commands/analyze.c#L1723-L1756.
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: rjuju123@gmail.com, kobruleht2@hot.ee
Subject: Re: Why there is 30000 rows is sample
In-Reply-To: <20200404072851.3w4xokdm5mlzkpos@nol>
References: <3D72D8D12557453AB3E0EB46FB911C17@dell2> <20200404072851.3w4xokdm5mlzkpos@nol>
* 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