Re: Join efficiency

From: Laura Vance <vancel(at)winfreeacademy(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Join efficiency
Date: 2004-09-01 15:36:29
Message-ID: 4135EC7D.6070009@winfreeacademy.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

This thread also brings up the question... what ever happened to the *
notation of the SQL2 standard for LEFT and RIGHT outer joins?

To pull all rows from table 'a' and only those from table 'b' that match
the column criteria.
SELECT * FROM a, b WHERE a.x*=b.x;

To pull all rows from table 'b' and only those from table 'a' that match
the column criteria.
SELECT * FROM a, b WHERE a.x=*b.x;

This notation was always easy to remember when you think of the asterisk
as being a wildcard (or 'all') for its side of the expression.

Russ Brown wrote:

> Hello all,
>
> Recently a post on this list made me think a bit about the way in
> which I write my queries.
>
> I have always written queries with ordinary joins in this manner:
>
> SELECT * FROM a, b WHERE a.x=b.x;
>
> However I recently saw an laternative syntax:
>
> SELECT * FROM a JOIN b ON a.x=b.x;
>
> Is there any difference between these queries in terms of the speed
> of planning or the quality of the plan untimately used? I'd imagine
> that the second form provides more information that the planner may
> be able to use to make a better plan (or make a good plan more
> easily), but I've never had any problems with the first form.
>
> It also seems to me that the second form is more self-documenting,
> which is something I'm always in favour of.
>
> I'd appreciate anyone's thought/insight.
>
> Thanks.
>

--
Thanks,
Laura Vance
Systems Engineer
Winfree Academy Charter Schools
6221 Riverside Dr. Suite 110
Irving, Tx 75039
Web: www.winfreeacademy.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John DeSoi 2004-09-01 15:36:42 stand-alone psql
Previous Message terry 2004-09-01 15:27:29 Re: PostgreSQL and Fedora?