Re: Performance of subselects

From: Thom Brown <thombrown(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-09 11:49:43
Message-ID: bddc86150903090449g5441b5fcrcee147d66ce7e1e8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2009/3/6 Christian Schröder <cs(at)deriva(dot)de>

> 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.
>

Couldn't you also use: SELECT fk FROM b EXCEPT SELECT id FROM a;

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joe Steeve 2009-03-09 13:32:41 recovering databases in tablespace (lost main database)
Previous Message Scott Marlowe 2009-03-09 11:24:25 Re: Performance of subselects