better approach: case or join - Mailing list pgsql-sql

From chester c young
Subject better approach: case or join
Date
Msg-id 828472.77350.qm@web54308.mail.yahoo.com
Whole thread Raw
List pgsql-sql
from id extracting name from several tables.  which is generally the
better approach?

select case when tab_tla='usr' then (select name from users where ... )      case when tab_tla='con' then (select title
fromcontents where
 
...)
end    as name;

as versus

select  name
from    users
where   tab_tla='usr' and ...       join
select  title
from    contents
where   tab_tla='con' and ...

I assume the former since the optimizer does not examine whether the
entire where clause might be false before executing the query.

thanks,
chester


____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html 


pgsql-sql by date:

Previous
From: T E Schmitz
Date:
Subject: triple self-join crawling
Next
From: roopa perumalraja
Date:
Subject: Help with sub query