X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id B07759FB30A for ; Tue, 19 Sep 2006 10:48:43 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 48166-02-4 for ; Tue, 19 Sep 2006 13:48:02 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from bay0-omc3-s14.bay0.hotmail.com (bay0-omc3-s14.bay0.hotmail.com [65.54.246.214]) by postgresql.org (Postfix) with ESMTP id 099A39FB2D2 for ; Tue, 19 Sep 2006 10:44:19 -0300 (ADT) Received: from hotmail.com ([64.4.11.52]) by bay0-omc3-s14.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 19 Sep 2006 06:44:18 -0700 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Tue, 19 Sep 2006 06:44:17 -0700 Message-ID: Received: from 80.24.52.85 by by7fd.bay7.hotmail.msn.com with HTTP; Tue, 19 Sep 2006 13:44:13 GMT X-Originating-IP: [80.24.52.85] X-Originating-Email: [im-james@hotmail.com] X-Sender: im-james@hotmail.com From: "James Im" To: pgsql-sql@postgresql.org Subject: Re: inner join is much faster! is that right? Date: Tue, 19 Sep 2006 13:44:13 +0000 Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-OriginalArrivalTime: 19 Sep 2006 13:44:17.0440 (UTC) FILETIME=[B3A87200:01C6DBF1] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.421 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, MSGID_FROM_MTA_HEADER, PLING_QUERY, SPF_PASS X-Spam-Level: ** X-Archive-Number: 200609/123 X-Sequence-Number: 26334 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