Re: Unusual slowdown using subselects

From: "Steve Wolfe" <steve(at)iboats(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Unusual slowdown using subselects
Date: 2001-05-16 21:29:32
Message-ID: 001b01c0de4f$60f7a940$50824e40@iboats.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ligia Pimentel 2001-05-16 21:32:51 Re: FATAL ERROR running query...
Previous Message Alexander Dederer 2001-05-16 21:28:11 Re: Tiiiiiiiiiiiiime