X-Original-To: pgsql-sql@postgresql.org Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id AC35747580B for ; Thu, 13 Mar 2003 19:12:39 -0500 (EST) Received: by news.hub.org (Postfix, from userid 8) id 8CDAE43A611; Thu, 13 Mar 2003 19:12:39 -0500 (EST) From: sarloc@jevic.com (Carmen) X-Newsgroups: comp.databases.postgresql.sql Subject: Poor performance on a right join Date: 13 Mar 2003 16:12:31 -0800 Organization: http://groups.google.com/ Lines: 16 Message-ID: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: groups-abuse@google.com To: pgsql-sql@postgresql.org X-Archive-Number: 200303/352 X-Sequence-Number: 12391 When doing a join query I am getting a responce time of 3 seconds. The callhist table has 66000 rows and the phone table has 10000 rows. I have an indexes on callhist.call_date, callhist.operator_id, phone.phone, & phone.cust_code. Here's the SQL SELECT a.CALL_DATE, a.OPERATOR_ID, a.CUST_CODE FROM PHONE as b right join CALLHIST as a on (a.CUST_CODE=b.CUST_CODE) where (b.PHONE = '555-555-5555') order by a.call_date desc; The postgres db is running on a 2 P3 700 processor server with 1GB of ram running Red Hat Linux 7.3. I am running PostgreSQL 7.2.2 Why is the query taking so long? What can I do to help the performance? Thanks in advance, Carmen