From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andreas Seltenreich <andreas.seltenreich@credativ.de>
Cc: pgsql-bugs@postgresql.org
Subject: Re: Unnecessarily imprecise stats for very small tables leading to bad plans
Date: Wed, 06 Jun 2018 11:28:13 -0400
Message-ID: <9101.1528298893@sss.pgh.pa.us> (raw)
In-Reply-To: <87o9gos42e.fsf@credativ.de>
References: <87o9gos42e.fsf@credativ.de>
Andreas Seltenreich <andreas.seltenreich@credativ.de> writes:
> Intuitively, I'd say pg_statistic can represent such a small dataset
> perfectly. But instead, most_common_values only contains one of the two
> distinct values. This seems like a bug to me. I looked at the code for
> why this is the case, but couldn't find an answer right-away. Any
> input?
ANALYZE has a hard-and-fast rule that a value must appear more than once
in the sample in order to possibly be considered an MCV.
Perhaps we could tinker with that if the sample is known to comprise
the entire table, but it feels a bit ad-hoc.
regards, tom lane
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-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, andreas.seltenreich@credativ.de
Subject: Re: Unnecessarily imprecise stats for very small tables leading to bad plans
In-Reply-To: <9101.1528298893@sss.pgh.pa.us>
References: <87o9gos42e.fsf@credativ.de> <9101.1528298893@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