Re: inner join is much faster! is that right?

Поиск
Список
Период
Сортировка
От Chris Mair
Тема Re: inner join is much faster! is that right?
Дата
Msg-id 1158668977.15510.19.camel@ultra.home.lan
обсуждение исходный текст
Ответ на inner join is much faster! is that right?  ("James Im" <im-james@hotmail.com>)
Список pgsql-sql
> I really thought that Postgresql would rewrite a query from
> 
> select *
> from file a, file_tag b, tag c
> where a.id_file=b.id_file and b.id_tag=c.id_tag and a.id_file=10000001000000
> 
> to something like:
> 
> select *
> from (file a inner join file_tag b on (a.id_file=b.id_file)) inner join
> tag c on (b.id_tag=c.id_tag)
> where a.id_file=10000001000000

These shouldn't be other than two ways to express the same (inner)
join.

Your timings seem to suggest that in the first case PG computes
the whole join between 3 tables and only then applies the filter
in a.

Can you send the outputs of "explain <query>" for these two and
let us know what version of PG this is?

Bye, Chris.


-- 

Chris Mair
http://www.1006.org



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

Предыдущее
От: "Ezequias Rodrigues da Rocha"
Дата:
Сообщение: Borland Database Engine assumes Varchar(255) as Memo
Следующее
От: "James Im"
Дата:
Сообщение: Re: inner join is much faster! is that right?