Re: Performance of subselects

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Christian Schröder <cs(at)deriva(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Performance of subselects
Date: 2009-03-06 07:07:00
Message-ID: dcc563d10903052307tbd96bf2q2eecf9d9d2fb5ca8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Mar 5, 2009 at 11:25 PM, Christian Schröder <cs(at)deriva(dot)de> wrote:
> Hi list,
> if I want to find all records from a table that don't have a matching record
> in another table there are at least two ways to do it: Using a left outer
> join or using a subselect. I always thought that the planner would create
> identical plans for both approaches, but actually they are quite different
> which leads to a bad performance in one case.
> I tried the following test case:

SNIP

> All tests have been performed on a PostgreSQL 8.2.9 server:

Have you looked at the release notes for 8.2.12? Especially this line:

Fix planner misestimation of selectivity when transitive equality is
applied to an outer-join clause (Tom)

This could result in bad plans for queries like ... from a left join b
on a.a1 = b.b1 where a.a1 = 42 ...

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Nico Grubert 2009-03-06 07:35:33 Re: After Upgrade from 8.2.6 to 8.3.6: function to_timestamp does not exist
Previous Message Adam Rich 2009-03-06 07:04:51 Re: After Upgrade from 8.2.6 to 8.3.6: function to_timestamp does not exist