Skip site navigation (1) Skip section navigation (2)

Re: Unusual slowdown using subselects

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: John Aughey <jha(at)washucsc(dot)org>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Unusual slowdown using subselects
Date: 2001-05-17 00:53:07
Message-ID: 7991.990060787@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
John Aughey <jha(at)washucsc(dot)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

In response to

pgsql-bugs by date

Next:From: pgsql-bugsDate: 2001-05-17 17:45:32
Subject: pqReadData() -- backend closed the channel unexpectedly.
Previous:From: Stephan SzaboDate: 2001-05-16 23:32:34
Subject: Re: orphaned trigger

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group