On Sat, 18 Oct 2014 11:34:18 -0400, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> If the comparison value is outside the range recorded in the histogram,
> and there's a suitable index available, the planner uses the index to
> find out the actual column min or max rather than believing the
histogram
> completely. See get_actual_variable_range().
Substituting the first histogram value with 1 (the lowest value in the
column/index) and redoing the calculation give the same numbers as the
EXPLAIN ANALISE does.
But how so that the selectivity is now not capped to 0.0001? Without the
index I couldn't get an estimate lower than 100 rows, but with the index
the estimates go all the way down to 1.
> Possibly this behavior ought to be mentioned in the docs ...
It would help a lot :)
Regards,
Mladen Marinović