Re: Improving a simple query?

Поиск
Список
Период
Сортировка
От nolan@celery.tssi.com
Тема Re: Improving a simple query?
Дата
Msg-id 20030714012347.18920.qmail@celery.tssi.com
обсуждение исходный текст
Ответ на Re: Improving a simple query?  (Steve Wampler <swampler@noao.edu>)
Список pgsql-performance
> > Could you not rewrite this as a simple join though?
>
> Hmmm, I don't see how.  Then again, I'm pretty much the village
> idiot w.r.t. SQL...
>
> The inner select is locating a set of (2049) ids (actually from
> the same table, since 'attributes' is just a view into
> 'attributes_table').  The outer select is then locating all
> records (~30-40K) that have any of those ids.  Is that really
> something a JOIN could be used for?

This may be a question for SQL theoretists, but I don't think I've ever
run across a query with a 'where in' clause that couldn't be written
as a join.  I think linguistically 'where in' may even be a special
case of 'join'.

Yet another question for the theoretists:  Would it be possible to optimize
a 'where in' query by rewriting it as a join?
--
Mike Nolan

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

Предыдущее
От: Hannu Krosing
Дата:
Сообщение: Re: Improving a simple query?
Следующее
От: Chris Bowlby
Дата:
Сообщение: Re: Improving a simple query?