From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Oleg Lebedev <olebedev(at)waterford(dot)org> |
Cc: | Postgres SQL Mailing List <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: sequential joins |
Date: | 2002-03-01 23:43:16 |
Message-ID: | 3663.1015026196@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Oleg Lebedev <olebedev(at)waterford(dot)org> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Oleg Lebedev | 2002-03-01 23:47:15 | Re: sequential joins |
Previous Message | Josh Berkus | 2002-03-01 23:13:31 | Re: sequential joins |