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

sub queries and caching.

From: mlw <markw(at)mohawksoft(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: sub queries and caching.
Date: 2001-07-21 18:48:58
Message-ID: 3B59CE9A.A9516E27@mohawksoft.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Take these queries:

select * from foo as F, (select * from bar where name = 'bla') as B where
F.name = B.name
union all
select * from foo as F, (select * from bar where name = 'bla') as B where
F.type = B.type

OR 

create temp table B as select * from bar where name = 'bla';
select * from foo as F, B where F.name = B.name
union all
select * from foo as F, B where F.type = B.type;
drop table B;

My question is, which would be more efficient, or is it a wash?
(A note, I will be calling this from an external programming laguage, PHP, so
the first query would be one Postgres pq_exec call, while the second query
would be three separate calls.)


-- 
5-4-3-2-1 Thunderbirds are GO!
------------------------
http://www.mohawksoft.com

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2001-07-21 20:45:54
Subject: WIN32 errno patch
Previous:From: Bruce MomjianDate: 2001-07-21 18:30:45
Subject: Re: Large queries - again...

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