Here's an example:
create view master_detailas select * from master left join detail on (master.detail_key=detail.key);
I noticed that PostgreSQ performs join even when I execute
select some_master_fields from master_detail;
but there exists an unique index on detail.key, so above query
gives the same result as
select some_master_fields from master;
but with much loss in performance, of course.
This problem emerged when I replaced renundant table in poorly
designed database with two tables, view and set of rules.
I thought that I was very clever, because I didn't have to
replace any code in applications using this database, but
it seems that there's always a catch...
May I have hope that such optimisation will be included in
TODO list in near future?
-- <><><><><><><><><><><><><><><><><><><><><> <> magic.robson@rassun.art.pl <> <>
http://rainbow.mimuw.edu.pl/~robson<> <><><><><><><><><><><><><><><><><><><><><>