From: | ta145(at)yahoo(dot)com (Trey Ackerman) |
---|---|
To: | pgsql-general(at)postgresql(dot)org, pgsql-php(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org |
Subject: | looking to speed up SELECT ... LEFT JOIN query |
Date: | 2002-08-07 05:03:55 |
Message-ID: | 1b23bd38.0208062103.3ec45a2b@posting.google.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-sql |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Patrick Nelson | 2002-08-07 05:46:07 | Importing blob |
Previous Message | Tom Lane | 2002-08-07 03:47:00 | Re: inet <<= and indexes |
From | Date | Subject | |
---|---|---|---|
Next Message | Bhuvan A | 2002-08-07 08:27:56 | Effective usage without unique key -- suggestion |
Previous Message | Josh Berkus | 2002-08-07 03:52:31 | Re: Limit A Table To 1 Row |