pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jerry Gamache <jerry.gamache@idilia.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Logarithmic data frequency distributions and the query planner
Date: Wed, 07 Jul 2010 17:22:00 -0400
Message-ID: <16024.1278537720@sss.pgh.pa.us> (raw)
In-Reply-To: <4C34E998.3020000@idilia.com>
References: <4C34E998.3020000@idilia.com>

Jerry Gamache <jerry.gamache@idilia.com> writes:
> On 8.1, I have a very interesting database where the distributions of 
> some values in a multi-million rows table is logarithmic (i.e. the most 
> frequent value is an order of magnitude more frequent than the next 
> ones). If I analyze the table, the statistics become extremely skewed 
> towards the most frequent values and this prevents the planner from 
> giving any good results on queries that do not target these entries.

Highly skewed distributions are hardly unusual, and I'm not aware that
the planner is totally incapable of dealing with them.  You do need a
large enough stats target to get down into the tail of the
distribution (the default target for 8.1 is probably too small for you).
It might be that there have been some other relevant improvements since
8.1, too ...

			regards, tom lane



view thread (2+ messages)

Message-ID: <16024.1278537720@sss.pgh.pa.us>
Permalink:  ../16024.1278537720@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/16024.1278537720@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, jerry.gamache@idilia.com
  Subject: Re: Logarithmic data frequency distributions and the query planner
  In-Reply-To: <16024.1278537720@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