Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 865ED47591E; Wed, 7 Aug 2002 01:06:32 -0400 (EDT) Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id E5B4547589E; Wed, 7 Aug 2002 01:06:31 -0400 (EDT) Received: by news.hub.org (Postfix, from userid 8) id C0F5938204E; Wed, 7 Aug 2002 01:06:14 -0400 (EDT) From: ta145@yahoo.com (Trey Ackerman) X-Newsgroups: comp.databases.postgresql.sql, comp.databases.postgresql.questions, comp.databases.postgresql.interfaces.php Subject: looking to speed up SELECT ... LEFT JOIN query Date: 6 Aug 2002 22:03:55 -0700 Organization: http://groups.google.com/ Lines: 18 Message-ID: <1b23bd38.0208062103.3ec45a2b@posting.google.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: groups-abuse@google.com To: pgsql-general@postgresql.org, pgsql-php@postgresql.org, pgsql-sql@postgresql.org X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/365 X-Sequence-Number: 28710 Hi, I have a working SELECT statement using LEFT JOIN but I'm hoping someone can suggest something that might be a bit quicker (currently 3 seconds for result). SELECT * FROM ((table1 LEFT JOIN table2 USING (custno)) AS j1 LEFT JOIN table3 USING (custno)) AS j2 LEFT JOIN table4 USING (custno) WHERE custno='$custno'; The primary table is table1, the key for all tables is 'custno'. I need the LEFT JOIN because any one or all of the other tables (table2, table3, table4) might not have corresponding data. Regards, Trey Ackerman