Re: inner join is much faster! is that right? - Mailing list pgsql-sql

From Chris Mair
Subject Re: inner join is much faster! is that right?
Date
Msg-id 1158668977.15510.19.camel@ultra.home.lan
Whole thread Raw
In response to inner join is much faster! is that right?  ("James Im" <im-james@hotmail.com>)
List 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 by date:

Previous
From: "Ezequias Rodrigues da Rocha"
Date:
Subject: Borland Database Engine assumes Varchar(255) as Memo
Next
From: "James Im"
Date:
Subject: Re: inner join is much faster! is that right?