Re: Pushing IN (subquery) down through UNION ALL?

From: Vik Reykja <vikreykja(at)gmail(dot)com>
To: Dave Johansen <davejohansen(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Pushing IN (subquery) down through UNION ALL?
Date: 2011-02-24 19:33:00
Message-ID: AANLkTik9bt8Yu1SxbexqZt=fJifG9nKtM6Oqck650Zp+@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Thu, Feb 24, 2011 at 16:14, Dave Johansen <davejohansen(at)gmail(dot)com> wrote:

> You'll notice that the subquery version is doing the full join and then the
> filtering, but the explicitly listed version pushing the filtering into the
> plan before the join. Is there a way to make the subquery version perform
> the same optimization?
>

EXPLAIN ANALYZE SELECT * FROM addressesall WHERE id = ANY (array(SELECT id
FROM users WHERE name='A'));

(Tested on 9.0.3)

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Shaun Thomas 2011-02-24 19:36:32 Re: Unused indices
Previous Message Greg Smith 2011-02-24 18:13:12 Re: Unused indices