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

From Steve Wolfe
Subject Re: Unusual slowdown using subselects
Date
Msg-id 001b01c0de4f$60f7a940$50824e40@iboats.com
Whole thread Raw
In response to Unusual slowdown using subselects  (John Aughey <jha@washucsc.org>)
List pgsql-general
> calendar=# explain select * from schedule where schedule.owner_id in
> (select group_id from groups where user_id=101);

> calendar=# explain select * from schedule where schedule.owner_id=101 or
> schedule.owner_id=102;

  A sub-select is different than a join, and is tretaed differently by the
database, and they are much, much slower than simply doing a join.  So, we
use subselects only when absolutely, positively necessary, otherwise, we
just do a join.

steve



pgsql-general by date:

Previous
From: John Aughey
Date:
Subject: Unusual slowdown using subselects
Next
From: Stephan Szabo
Date:
Subject: Re: Unusual slowdown using subselects