Search Postgresql Archives

Re: where clauses and multiple tables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yaroslav Tykhiy wrote:
By the way, folks, do you think there may be performance gain or loss from rewriting this with an explicit JOIN? E.g.:

SELECT DISTINCT foo.foo_id, foo.name FROM foo JOIN bar ON foo.bar_id = bar.bar_id WHERE bar.name='martini';

I would expect that to be more efficient as its the 'proper' SQL way of doing things, and the optimizer will do a better job on it, especially if foo.bar_id is a FK to bar.bar_id's primary key.

btw, can't this be written...

   SELECT DISTINCT foo.foo_id, foo.name
       FROM foo JOIN bar ON bar_id
       WHERE bar.name='martini';


?



--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux