On Sun, 2 Sep 2012, Peter Geoghegan wrote:
> On 2 September 2012 16:26, Sergey Koposov <koposov@ast.cam.ac.uk> wrote:
>
> That's why we support altering that value with an ALTER TABLE...ALTER
> COLUMN DDL statement. You might at least consider increasing the
> statistics target for the column first though, to see if that will
> make the n_distinct value better accord with reality.
Thanks, I've forgot about that possibility.
After fixing the n_distinct to the correct value the index scan became the
preferred option. and the row number estimate for the index scan became
more realistic
Sorry for the noise. Sergey
*****************************************************
Sergey E. Koposov, PhD, Research Associate
Institute of Astronomy, University of Cambridge
Madingley road, CB3 0HA, Cambridge, UK
Tel: +44-1223-337-551 Web: http://www.ast.cam.ac.uk/~koposov/