Re: Incorrect estimates on correlated filters

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Chris Kratz <chris(dot)kratz(at)vistashare(dot)com>
Cc: Decibel! <decibel(at)decibel(dot)org>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Incorrect estimates on correlated filters
Date: 2008-08-13 20:58:30
Message-ID: 20080813205830.GC4672@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Alvaro Herrera 2008-08-13 21:28:38 autovacuum: use case for indenpedent TOAST table autovac settings
Previous Message Henrik 2008-08-13 19:54:43 Re: Filesystem benchmarking for pg 8.3.3 server