Re: View vs. Statement Query Plan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Curt Sampson <cjs(at)cynic(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: View vs. Statement Query Plan
Date: 2002-06-04 05:15:38
Message-ID: 14790.1023167738@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Curt Sampson <cjs(at)cynic(dot)net> writes:
> But for some reason this view doesn't use the indices that an
> equivalant query uses:

You're essentially supposing that

select * from (select * from a union select * from b) where foo;

may be transformed into

(select * from a where foo) union (select * from b where foo);

I don't doubt that this transformation is valid in some cases ... but
I do doubt that it is valid in all cases. If someone can supply a
rigorous proof about when it is valid, I'd be willing to look into
doing the necessary programming.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gregory Seidman 2002-06-04 05:20:12 Re: Updates failing yet saying they succeeded.
Previous Message Oliver Jones 2002-06-04 05:11:37 Updates failing yet saying they succeeded.