Re: Unnecessarily imprecise stats for very small tables leading to bad plans - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Unnecessarily imprecise stats for very small tables leading to bad plans
Date
Msg-id 9101.1528298893@sss.pgh.pa.us
Whole thread Raw
In response to Unnecessarily imprecise stats for very small tables leading to bad plans  (Andreas Seltenreich <andreas.seltenreich@credativ.de>)
List pgsql-bugs
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


pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: psql crashes found when executing slash commands
Next
From: Frits Jalvingh
Date:
Subject: Re: BUG #15225: [XX000] ERROR: invalid DSA memory alloc request size1073741824 / Where: parallel worker