Multiple selects versus join - Mailing list pgsql-general

From Jean-Christian Imbeault
Subject Multiple selects versus join
Date
Msg-id 3D61A2D8.8060202@mega-bucks.co.jp
Whole thread Raw
Responses Re: Multiple selects versus join
List pgsql-general
Is it more efficient to do multiple selects on multiple tables to get
data or do a join of those tables and extract the data from the
resulting temp table?

For example:

select name from a where id=1;
select pub_date from b where id=1;
pub_id = select publisher_id from c where id=1;
select pub_name from d where id = pub_id;

or (I don't know the syntax for join so this is just pseudo-sql);

select name, pub_date, pub_name from join((join(A, B, C) on id), D) on
pub_id where id = 1;

All my tables are related to each other so I am wondering which is more
efficient, do multile selects or joining the tables. (Joining the table
would return just one row).

Thanks for the advice and sorry if the pseudo-sql is hard to understand.

Jc


pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: About to update the PostgreSQL-Functions in the PHP Manual
Next
From: Tom Lane
Date:
Subject: Re: Functions question