Multiple selects versus join

Поиск
Список
Период
Сортировка
От Jean-Christian Imbeault
Тема Multiple selects versus join
Дата
Msg-id 3D61A2D8.8060202@mega-bucks.co.jp
обсуждение исходный текст
Ответы Re: Multiple selects versus join  (Adrian 'Dagurashibanipal' von Bidder <avbidder@fortytwo.ch>)
Список 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 по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: About to update the PostgreSQL-Functions in the PHP Manual
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Functions question