pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <ringerc@ringerc.id.au>
To: niko.kiirala@mapvision.fi
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #7619: Query cost estimate appears to not use n_distinct setting
Date: Tue, 23 Oct 2012 20:32:50 +0800
Message-ID: <50868E72.6020306@ringerc.id.au> (raw)
In-Reply-To: <E1TQc0I-0001qW-7d@wrigleys.postgresql.org>
References: <E1TQc0I-0001qW-7d@wrigleys.postgresql.org>

On 10/23/2012 06:46 PM, niko.kiirala@mapvision.fi wrote:
> The following bug has been logged on the website:
> 
> Bug reference:      7619
> Logged by:          Niko Kiirala
> Email address:      niko.kiirala@mapvision.fi
> PostgreSQL version: 9.2.1
> Operating system:   Windows 7 SP 1 (64-bit)
> Description:        
> 
> I am working on a potentially large database table, let's call it
> "observation", that has a foreign key to table "measurement". Each
> measurement is associated with either none or around five observations. In
> this kind of situation, it is well known that the statistics on the foreign
> key column in observation table can get arbitrarily bad as the row count
> increases. Especially, the estimate of the number of distinct values in the
> foreign key column can be completely off.

For anyone wondering why this feels familiar, the same message was
posted to pgsql-performance earlier:

http://postgresql.1045698.n5.nabble.com/High-cost-estimates-when-n-distinct-is-set-td5728596.html

It's clear that there's a practical performance issue here, but less
clear that it's a bug. Nonetheless, thanks for writing it up in so much
detail and chasing it up further - though it'd be nice if you'd
mentioned your earlier post.

I'd love to help, but you've clearly already done a lot of work on this
and I'm not sure I have anything useful to add.

If you don't have any luck, consider asking one of the professional
PostgreSQL consulting firms for their input.

--
Craig Ringer





view thread (4+ messages)  latest in thread

Message-ID: <50868E72.6020306@ringerc.id.au>
Permalink:  ../50868E72.6020306@ringerc.id.au/
Also on:    postgresql.org/message-id/50868E72.6020306@ringerc.id.au

 · 

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-bugs@postgresql.org
  Cc: ringerc@ringerc.id.au, niko.kiirala@mapvision.fi
  Subject: Re: BUG #7619: Query cost estimate appears to not use n_distinct setting
  In-Reply-To: <50868E72.6020306@ringerc.id.au>
  References: <E1TQc0I-0001qW-7d@wrigleys.postgresql.org> <50868E72.6020306@ringerc.id.au>

* 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