pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: ta145@yahoo.com
To: pgsql-general@postgresql.org
To: pgsql-php@postgresql.org
To: pgsql-sql@postgresql.org
Subject: looking to speed up SELECT ... LEFT JOIN query
Date: 6 Aug 2002 22:03:55 -0700
Message-ID: <1b23bd38.0208062103.3ec45a2b@posting.google.com> (raw)

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



view thread (2+ messages)  latest in thread

Message-ID: <1b23bd38.0208062103.3ec45a2b@posting.google.com>
Permalink:  ../1b23bd38.0208062103.3ec45a2b@posting.google.com/
Also on:    postgresql.org/message-id/1b23bd38.0208062103.3ec45a2b@posting.google.com

 · 

reply

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: ta145@yahoo.com, pgsql-general@postgresql.org, pgsql-php@postgresql.org
  Subject: Re: looking to speed up SELECT ... LEFT JOIN query
  In-Reply-To: <1b23bd38.0208062103.3ec45a2b@posting.google.com>

* 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