From: James Im <im-james@hotmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: inner join is much faster! is that right?
Date: Tue, 19 Sep 2006 13:44:13 +0000
Message-ID: <BAY7-F27352E5152460F67D8E96896220@phx.gbl> (raw)
I was doing the explain thing when I discovered my mistake!
The think is that I over simplyfied my examples. instead of searching
for one ID, I was searching for several ids and I forgot to put a
parentesis arround the or like this.
I was doing this:
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 or a.id_file=10000001000200
But I should have done this:
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 or a.id_file=10000001000200)
This changes everything. The performance is now acceptable!
_________________________________________________________________
Vælg selv hvordan du vil kommunikere - skrift, tale, video eller billeder
med MSN Messenger: http://messenger.msn.dk/ - her kan du det hele
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: im-james@hotmail.com
Subject: Re: inner join is much faster! is that right?
In-Reply-To: <BAY7-F27352E5152460F67D8E96896220@phx.gbl>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox