pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgreSQL.org
Subject: Re: Odd problem with performance in duplicate database
Date: Mon, 11 Aug 2003 17:51:39 -0700
Message-ID: <200308111751.39998.josh@agliodbs.com> (raw)
In-Reply-To: <27573.1060648162@sss.pgh.pa.us>
References: <ENEDIMLCODBHILEONAOMAEBNCEAA.pdarley@kinesis-cem.com>
	<200308111716.22288.josh@agliodbs.com>
	<27573.1060648162@sss.pgh.pa.us>

Tom,

> Partly.  The numbers suggest that in ANALYZE's default sample of 3000
> rows, it's only finding about a dozen non-null tgroup_ids (yielding the
> 0.996 null_frac value); and that in one case all dozen are different and
> in the other case there are two duplicates.  It would help if you
> boosted the stats target for this column by a factor of 10.  (You can
> do that in 7.2, btw --- IIRC the only problem is that a pg_dump won't
> show that you did so.)

Hmmm.  No dice.   I raised the selectivity to 1000, which increased n_distinct 
to 108, which is pretty close to accurate.  However, the planner still 
insists on using a seq scan on case_clients unless I drop random_page_cost to 
1.5 (which is up from 1.2 but still somewhat unreasonable).

> But the other part of the problem is that in 7.2, the join selectivity
> estimator is way off when you are joining a unique column (like the pkey
> on the other side) to a column with a very large fraction of nulls.
> We only discovered this recently; it's fixed as of 7.3.3:

OK, I'll talk to the client about upgrading.

-- 
-Josh Berkus

______AGLIO DATABASE SOLUTIONS___________________________
                                        Josh Berkus
   Complete information technology 	josh@agliodbs.com
    and data management solutions 	(415) 565-7293
   for law firms, small businesses 	 fax 621-2533
    and non-profit organizations. 	San Francisco




view thread (14+ messages)  latest in thread

Message-ID: <200308111751.39998.josh@agliodbs.com>
Permalink:  ../200308111751.39998.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200308111751.39998.josh@agliodbs.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-performance@postgresql.org
  Cc: josh@agliodbs.com, tgl@sss.pgh.pa.us
  Subject: Re: Odd problem with performance in duplicate database
  In-Reply-To: <200308111751.39998.josh@agliodbs.com>
  References: <ENEDIMLCODBHILEONAOMAEBNCEAA.pdarley@kinesis-cem.com> <200308111716.22288.josh@agliodbs.com> <27573.1060648162@sss.pgh.pa.us> <200308111751.39998.josh@agliodbs.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