On Jul 6, 2012, at 9:24 PM, Gurjeet Singh wrote:
> On Thu, Jul 5, 2012 at 7:16 PM, Steven Schlansker wrote:
>
> On Jul 5, 2012, at 3:51 PM, Tom Lane wrote:
>
> > Steven Schlansker writes:
> >> Why is using an OR so awful here?
> >
> > Because the OR stops it from being a join (it possibly need
On Thu, Jul 5, 2012 at 7:16 PM, Steven Schlansker wrote:
>
> On Jul 5, 2012, at 3:51 PM, Tom Lane wrote:
>
> > Steven Schlansker writes:
> >> Why is using an OR so awful here?
> >
> > Because the OR stops it from being a join (it possibly needs to return
> > some rows that are not in the semijoin
On Jul 5, 2012, at 6:35 PM, Jasen Betts wrote:
> I note you've decided to rewrite this query as a union
>
>> SELECT * FROM account
>> WHERE user_id in
>>(SELECT user_id FROM account
>> WHERE id =
>> ANY('{-02f6-379d-c000-00026810,-0320-b467-c000-00026810,000
I note you've decided to rewrite this query as a union
> SELECT * FROM account
> WHERE user_id in
> (SELECT user_id FROM account
> WHERE id =
> ANY('{-02f6-379d-c000-00026810,-0320-b467-c000-00026810,-000d-cefb-c000-00026810}'))
> OR
> id =
On Jul 5, 2012, at 3:51 PM, Tom Lane wrote:
> Steven Schlansker writes:
>> Why is using an OR so awful here?
>
> Because the OR stops it from being a join (it possibly needs to return
> some rows that are not in the semijoin of the two tables).
>
>> Why does it pick a sequential scan? Is this
Steven Schlansker writes:
> Why is using an OR so awful here?
Because the OR stops it from being a join (it possibly needs to return
some rows that are not in the semijoin of the two tables).
> Why does it pick a sequential scan? Is this an optimizer bug
No. It can't transform OR into a UNION