From: | Chris Mair <chrisnospam(at)1006(dot)org> |
---|---|
To: | James Im <im-james(at)hotmail(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: inner join is much faster! is that right? |
Date: | 2006-09-19 12:29:37 |
Message-ID: | 1158668977.15510.19.camel@ultra.home.lan |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | James Im | 2006-09-19 13:44:13 | Re: inner join is much faster! is that right? |
Previous Message | Ezequias Rodrigues da Rocha | 2006-09-19 12:11:51 | Borland Database Engine assumes Varchar(255) as Memo |