Re: An Analyze question - Mailing list pgsql-admin

From Tom Lane
Subject Re: An Analyze question
Date
Msg-id 26317.1019507557@sss.pgh.pa.us
Whole thread Raw
In response to Re: An Analyze question  ("Nick Fankhauser" <nickf@ontko.com>)
Responses Re: An Analyze question
List pgsql-admin
"Nick Fankhauser" <nickf@ontko.com> writes:
> In this case, we've got an unusual distribution that looks like this:

> Among the actors to which cases may be assigned:

> The State gets 10% of the cases
> 8 Judges get 3.5% of the cases each
> 50 Attorneys get about 0.1% each
> The remaining 388,000 actors get about 0.001% each.

> Given this unusual distribution, the planner can't predict well, so we're
> thinking that the best way to handle this is to set up a script to do our
> vacuum analyze, and then update stacommonfrac to be .01 for this particular
> field.

That's probably your best answer for 7.1 --- just force a suitable
fudge-factor into pg_statistic after any VACUUM ANALYZE run.

In 7.2, you could set the statistics target for actor_id to be 60 or 100
or so, and then the system would actually *know* the above distribution,
and moreover would know the names of the judges and the attorneys.
It'll be interesting to see how the plans change depending on whether
you are searching for a judge or not ...

            regards, tom lane

pgsql-admin by date:

Previous
From: "Nick Fankhauser"
Date:
Subject: Re: An Analyze question
Next
From: Jeremy Buchmann
Date:
Subject: Re: Hardware needed for 15,000,000 record DB?