pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@commandprompt.com>
To: Chris Kratz <chris.kratz@vistashare.com>
Cc: Decibel! <decibel@decibel.org>
Cc: pgsql-performance@postgresql.org
Subject: Re: Incorrect estimates on correlated filters
Date: Wed, 13 Aug 2008 16:58:30 -0400
Message-ID: <20080813205830.GC4672@alvh.no-ip.org> (raw)
In-Reply-To: <3642025c0808131145x61b9aec5l2d9cb0268d28e9ff@mail.gmail.com>
References: <3642025c0808121459x75c8d9baq66194b87f5053ea3@mail.gmail.com>
	<12707C41-48C3-4072-A152-46FAB1FEE1E2@decibel.org>
	<3642025c0808131145x61b9aec5l2d9cb0268d28e9ff@mail.gmail.com>

Chris Kratz wrote:

> Unfortunately, if I don't think the sorting idea would help in the one case
> I'm looking at which involves filters on two tables that are joined
> together.  The filters happen to be correlated such that about 95% of the
> rows from each filtered table are actually returned after the join.
> Unfortunately, the planner thinks we will get 1 row back.

Maybe you can wrap that part of the query in a SQL function and set its
estimated cost to the real values with ALTER FUNCTION ... ROWS.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support



view thread (7+ messages)  latest in thread

Message-ID: <20080813205830.GC4672@alvh.no-ip.org>
Permalink:  ../20080813205830.GC4672@alvh.no-ip.org/
Also on:    postgresql.org/message-id/20080813205830.GC4672@alvh.no-ip.org

 · 

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: alvherre@commandprompt.com, chris.kratz@vistashare.com, decibel@decibel.org
  Subject: Re: Incorrect estimates on correlated filters
  In-Reply-To: <20080813205830.GC4672@alvh.no-ip.org>

* 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