pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nick Fankhauser <nickf@ontko.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Cc: Ray Ontko <rayo@ontko.com>
Subject: Re: An Analyze question
Date: Mon, 22 Apr 2002 14:53:24 -0500
Message-ID: <NEBBLAAHGLEEPCGOBHDGIEEDENAA.nickf@ontko.com> (raw)
In-Reply-To: <17407.1019497221@sss.pgh.pa.us>


> In the "after" case you are showing "18105XS" as the most common
> actor_id, with a frequency of 11.2% of the entries.  Where'd that
> come from?  Is it correct?

I believe this is correct, and the reason I've not been getting poor
performance on the old database is that the stats are not up to date on the
*old* DB. I've been so focused on problems with the updated DB that I didn't
suspect that the database that was performing well had the "bad" stats.


> 7.1 basically uses stacommonfrac as the selectivity estimate if the
> constant is the stacommonval, otherwise stacommonfrac/10.  So if
> stacommonfrac goes up, so does the estimated number of rows retrieved,
> and that's what's changing your plan.

I understand. That piece of info put us on the track of a solution.

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.

This should give us great performance for the vast majority of the possible
queries. It looks like the 8 judges are on the borderline, and we'll get
poor performance if anyone happens to query on the State, but most of our
users should understand that would be a silly query anyway.

Is there another more graceful way to do this?

Tom- Thanks for your patient help with this. We'll be sure to try this
without the planner tweaks when we upgrade to 7.2 & let you know how it
goes.

regards,

-Nick









view thread (9+ messages)  latest in thread

Message-ID: <NEBBLAAHGLEEPCGOBHDGIEEDENAA.nickf@ontko.com>
Permalink:  ../NEBBLAAHGLEEPCGOBHDGIEEDENAA.nickf@ontko.com/
Also on:    postgresql.org/message-id/NEBBLAAHGLEEPCGOBHDGIEEDENAA.nickf@ontko.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: nickf@ontko.com, tgl@sss.pgh.pa.us, rayo@ontko.com
  Subject: Re: An Analyze question
  In-Reply-To: <NEBBLAAHGLEEPCGOBHDGIEEDENAA.nickf@ontko.com>
  References: <17407.1019497221@sss.pgh.pa.us> <NEBBLAAHGLEEPCGOBHDGIEEDENAA.nickf@ontko.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox