Received: from shire.ontko.com (shire.ontko.com [199.164.165.1]) by postgresql.org (Postfix) with ESMTP id 5D0EB4758F3 for ; Mon, 8 Apr 2002 17:25:23 -0400 (EDT) Received: from nick (bilbo.ontko.com [199.164.165.101]) by shire.ontko.com (8.9.3/8.9.3/Debian 8.9.3-21) with SMTP id QAA12646 for ; Mon, 8 Apr 2002 16:25:25 -0500 X-Authentication-Warning: shire.ontko.com: Host bilbo.ontko.com [199.164.165.101] claimed to be nick Reply-To: From: "Nick Fankhauser" To: "pgsql-admin" Subject: Will an outer join on two indexed fields use the indexes? Date: Mon, 8 Apr 2002 16:24:18 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Importance: Normal X-Archive-Number: 200204/74 X-Sequence-Number: 3962 Hi- I've got another "plan" question- I'm trying to tune a query that uses an outer join on two indexed (not unique) fields. I did an explain on it & was surprised to find that the index wasn't used: monroe=# explain select * from monroe-# (charge left outer join criminal_disposition on monroe(# (charge.charge_id = criminal_disposition.charge_id)); NOTICE: QUERY PLAN: Hash Join (cost=260.68..21110.40 rows=147101 width=360) -> Seq Scan on charge (cost=0.00..4883.01 rows=147101 width=252) -> Hash (cost=150.94..150.94 rows=5894 width=108) -> Seq Scan on criminal_disposition (cost=0.00..150.94 rows=5894 width=108) My question is- Does the fact that this is an outer join cause this, or is soem other factor involved? If it is the outer join, is there a different way to join these which will be more efficient? Thanks! -Nick -------------------------------------------------------------------------- Nick Fankhauser nickf@ontko.com Phone 1.765.935.4283 Fax 1.765.962.9788 Ray Ontko & Co. Software Consulting Services http://www.ontko.com/