From: | Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)jp> |
---|---|
To: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Multiple selects versus join |
Date: | 2002-08-20 02:00:56 |
Message-ID: | 3D61A2D8.8060202@mega-bucks.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-08-20 02:37:28 | Re: Functions question |
Previous Message | Bruce Momjian | 2002-08-20 01:44:33 | Re: About to update the PostgreSQL-Functions in the PHP Manual |