Re: Subqueries and the optimizer

Поиск
Список
Период
Сортировка
От Mike Mascari
Тема Re: Subqueries and the optimizer
Дата
Msg-id 3EC94AE7.2040508@mascari.com
обсуждение исходный текст
Ответ на Re: Subqueries and the optimizer  ("Dmitri Bichko" <dbichko@genpathpharma.com>)
Список pgsql-general
Dmitri Bichko wrote:
> I wish it were as easy as a join - the query is much simplified for the
> purpose of the example, in reality the subselect is more complicated and
> includes a GROUP BY (which, at least as far as I know, makes subqueries
> the only way of doing this).
>
> Thanks anway, guess I'll wait for 7.4 with this (and just split them up
> into two queries for the time being),

Did you try a correlated subquery using EXISTS? You can make that
subquery as complicated as you want. The semantics between IN and
EXISTS vary though in the prescence of NULLs.

SELECT blast_id
FROM genes
WHERE blast_batch_id = 2 AND EXISTS (
 SELECT 1
 FROM ll_out_mm
 WHERE ll_out_mm.locusid = genes.locus_id AND
 ...
};

Mike Mascari
mascarm@mascari.com




В списке pgsql-general по дате отправления:

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: Subqueries and the optimizer
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Subqueries and the optimizer