Re: where clauses and multiple tables

Поиск
Список
Период
Сортировка
От John R Pierce
Тема Re: where clauses and multiple tables
Дата
Msg-id 4AA709F9.7010103@hogranch.com
обсуждение исходный текст
Ответ на Re: where clauses and multiple tables  (Yaroslav Tykhiy <yar@barnet.com.au>)
Ответы Re: where clauses and multiple tables  (David W Noon <dwnoon@ntlworld.com>)
Список pgsql-general
Yaroslav Tykhiy wrote:
> By the way, folks, do you think there may be performance gain or loss
> from rewriting this with an explicit JOIN?  E.g.:
>
> SELECT DISTINCT foo.foo_id, foo.name FROM foo JOIN bar ON foo.bar_id =
> bar.bar_id WHERE bar.name='martini';

I would expect that to be more efficient as its the 'proper' SQL way of
doing things, and the optimizer will do a better job on it, especially
if foo.bar_id is a FK to bar.bar_id's primary key.

btw, can't this be written...

    SELECT DISTINCT foo.foo_id, foo.name
        FROM foo JOIN bar ON bar_id
        WHERE bar.name='martini';


?



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

Предыдущее
От: Yaroslav Tykhiy
Дата:
Сообщение: Re: Can I Save images in postgres?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Using symbolic links with tablespaces