Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 06206475894 for ; Mon, 22 Apr 2002 16:32:37 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g3MKWbF26320; Mon, 22 Apr 2002 16:32:37 -0400 (EDT) To: nickf@ontko.com Cc: "pgsql-admin" , "Ray Ontko" Subject: Re: An Analyze question In-reply-to: References: Comments: In-reply-to "Nick Fankhauser" message dated "Mon, 22 Apr 2002 14:53:24 -0500" Date: Mon, 22 Apr 2002 16:32:37 -0400 Message-ID: <26317.1019507557@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200204/208 X-Sequence-Number: 4096 "Nick Fankhauser" 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