pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Dan Harris <fbsd@drivefaster.net>
Cc: PostgreSQL Performance <pgsql-performance@postgresql.org>
Subject: Re: Encouraging multi-table join order
Date: Tue, 11 Apr 2006 17:08:53 -0400
Message-ID: <10770.1144789733@sss.pgh.pa.us> (raw)
In-Reply-To: <443C18AA.3000500@drivefaster.net>
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>

Dan Harris <fbsd@drivefaster.net> writes:
> Tom Lane wrote:
>> What does the pg_stats entry for eventactivity.incidentid
>> contain?

> {P043190299,P051560740,P052581036,P052830218,P053100679,P053190889,P060370845,P042070391,P042690319,P043290117} 
> | 
> {0.00166667,0.00166667,0.00166667,0.00166667,0.00166667,0.00166667,0.00166667,0.00133333,0.00133333,0.00133333} 

> How high should I set this?  I read the default is 10, but I'm not sure 
> if doubling this would make a difference or if I should be doing a much 
> larger number. There's approx 45 million rows in the table, if that matters.

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



view thread (8+ messages)  latest in thread

Message-ID: <10770.1144789733@sss.pgh.pa.us>
Permalink:  ../10770.1144789733@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/10770.1144789733@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, fbsd@drivefaster.net
  Subject: Re: Encouraging multi-table join order
  In-Reply-To: <10770.1144789733@sss.pgh.pa.us>

* 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