Views and unique indicies optimisation

From: Robert Osowiecki <magic(dot)robson(at)rassun(dot)art(dot)pl>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Views and unique indicies optimisation
Date: 2003-02-10 19:12:01
Message-ID: 8646.1044902158.zmok@sepulka.mimuw.edu.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Here's an example:

create view master_detail
as 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(dot)robson(at)rassun(dot)art(dot)pl <>
<> http://rainbow.mimuw.edu.pl/~robson <>
<><><><><><><><><><><><><><><><><><><><><>

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2003-02-10 19:12:44 Re: PGP signing releases
Previous Message Tom Lane 2003-02-10 19:07:46 Re: Status report: regex replacement