Re: Unusual slowdown using subselects - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Unusual slowdown using subselects
Date
Msg-id 7991.990060787@sss.pgh.pa.us
Whole thread Raw
In response to Unusual slowdown using subselects  (John Aughey <jha@washucsc.org>)
List pgsql-bugs
John Aughey <jha@washucsc.org> writes:
> However, this next one is slow.

> calendar=# explain select * from schedule where schedule.owner_id in
> (select group_id from groups where user_id=101);

IN is not very well implemented at present.  You could try something
like this (in 7.1):

select schedule.* from schedule,
(select distinct group_id from groups where user_id=101) ss
where schedule.owner_id = ss.group_id;

            regards, tom lane

pgsql-bugs by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: orphaned trigger
Next
From: pgsql-bugs@postgresql.org
Date:
Subject: pqReadData() -- backend closed the channel unexpectedly.