Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id AADEF4758A2 for ; Fri, 1 Mar 2002 18:43:20 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g21NhGS03666; Fri, 1 Mar 2002 18:43:16 -0500 (EST) To: Oleg Lebedev Cc: Postgres SQL Mailing List Subject: Re: sequential joins In-reply-to: <3C801303.8DF6A0D1@waterford.org> References: <3C801303.8DF6A0D1@waterford.org> Comments: In-reply-to Oleg Lebedev message dated "Fri, 01 Mar 2002 16:47:15 -0700" Date: Fri, 01 Mar 2002 18:43:16 -0500 Message-ID: <3663.1015026196@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200203/17 X-Sequence-Number: 6899 Oleg Lebedev writes: > SELECT * > FROM > activity a > LEFT OUTER JOIN > (SELECT username AS artistname, > objectid AS userid > FROM user) u1 > ON a.artist = u1.userid; This seems like the hard way compared to SELECT a.*, u1.username AS artistname, u1.objectid AS userid ... more fields here ... FROM activity a LEFT OUTER JOIN user u1 ON a.artist = u1.userid ... more JOINs here ... I think that you will in fact end up with the same plan, but that's only because the PG planner is smart enough to convert the first into the second. Might as well save the notational cruft to begin with. regards, tom lane