> 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