Re: Query performance PLEASE HELP - Mailing list pgsql-general

From Tom Lane
Subject Re: Query performance PLEASE HELP
Date
Msg-id 24304.1044043986@sss.pgh.pa.us
Whole thread Raw
In response to Query performance PLEASE HELP  (Dmitry Tkach <dmitry@openratings.com>)
List pgsql-general
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

pgsql-general by date:

Previous
From: "Andy Kriger"
Date:
Subject: empty contrib diurectories?
Next
From: Simon Mitchell
Date:
Subject: Re: Basic SQL join question