pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dan Harris <fbsd@drivefaster.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Performance <pgsql-performance@postgresql.org>
Subject: Re: Encouraging multi-table join order
Date: Tue, 11 Apr 2006 15:21:48 -0600
Message-ID: <443C1DEC.4080307@drivefaster.net> (raw)
In-Reply-To: <10770.1144789733@sss.pgh.pa.us>
References: <443AAC26.4070802@drivefaster.net>
	<1543.1144710756@sss.pgh.pa.us>
	<443AEF9B.3000909@drivefaster.net>
	<2406.1144717297@sss.pgh.pa.us>
	<443C18AA.3000500@drivefaster.net>
	<10770.1144789733@sss.pgh.pa.us>

Tom Lane wrote:
> What the stats entry is saying is that the most common entries occur
> about 75000 times apiece (0.00166667 * 45e6), which is what's scaring
> the planner here ;-).  I think those frequencies are artificially high
> though.  The default statistics sample size is 3000 rows (300 *
> statistics target, actually), so those numbers correspond to 5 or 4
> rows in the sample, which is probably just random chance.
>
> Try increasing the stats targets for this table to 100, then re-ANALYZE
> and see what you get.  The most_common_freqs entries might drop as much
> as a factor of 10.
>
> 			regards, tom lane
>   

Tom:

I believe this was the problem.  I upped the statistics to 100, for a 
sample size of 30k and now the planner does the correct nested 
loop/index scan and takes only 30 seconds!  This is a HUGE performance 
increase.

I wonder why the estimates were so far off the first time?  This table 
has been ANALYZED regularly ever since creation.

Once again, thank you and all of the developers for your hard work on 
PostgreSQL.  This is by far the most pleasant management experience of 
any database I've worked on.

-Dan




view thread (8+ messages)  latest in thread

Message-ID: <443C1DEC.4080307@drivefaster.net>
Permalink:  ../443C1DEC.4080307@drivefaster.net/
Also on:    postgresql.org/message-id/443C1DEC.4080307@drivefaster.net

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: fbsd@drivefaster.net, tgl@sss.pgh.pa.us
  Subject: Re: Encouraging multi-table join order
  In-Reply-To: <443C1DEC.4080307@drivefaster.net>

* 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