Dmitry Tkach <dmitry@openratings.com> writes:
> What does NEGATIVE n_distinct mean (for managed_supplier.duns)? :-)
Fractional estimate --- in particular, -1 means it thinks the column
is unique. tradestyle.duns is not really unique by itself, is it?
> It lies about many things... For example - n_distinct for
> tradestyle.name = 385825 is about 100 times small than the actual number
> (which is a little over 30 million)
It might help to raise the statistics target for these columns and
re-ANALYZE. Try 100 or so instead of the default 10.
However, even with these stats I'd think it would pick up on the
tradestyle.name index as a likely thing to use. What was the
database's locale setting, again?
regards, tom lane