Skip site navigation (1) Skip section navigation (2)


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "T(dot) Alex Beamish" <talexb(at)tabsoft(dot)on(dot)ca>
Cc: "Postgresql-Performance" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: INNER JOIN vs WHERE
Date: 2003-05-15 02:25:55
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
"T. Alex Beamish" <talexb(at)tabsoft(dot)on(dot)ca> writes:
> Is there any rule of thumb about how much more efficient an INNER JOIN
> is compare to a regular WHERE statement?

Ideally there is no difference.  If there are only two tables involved,
there definitely is no difference.

If there is a difference, it's because there are more than two tables,
and the JOIN syntax forced a particular join order.  Read

Typically I'd expect JOIN syntax to be a loss because the odds are good
that you're forcing an inefficient join order.  It could be a win only
if the planner chooses a poor join order when given a free hand, or if
you have so many tables that you need to suppress the planner's search
for a good join order.

> I have not tried to do an EXPLAIN ANALYZE yet but I will try that.

If you have not bothered to do any EXPLAINs yet then you are really
wasting people's time on this list.

			regards, tom lane

In response to

pgsql-performance by date

Next:From: Rudi StarcevicDate: 2003-05-15 02:29:22
Subject: Re: constraint with reference to the same table
Previous:From: Victor YegorovDate: 2003-05-15 02:21:35
Subject: Re: constraint with reference to the same table

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group