Re: View vs. Statement Query Plan - Mailing list pgsql-general

From Tom Lane
Subject Re: View vs. Statement Query Plan
Date
Msg-id 14790.1023167738@sss.pgh.pa.us
Whole thread Raw
In response to View vs. Statement Query Plan  (Curt Sampson <cjs@cynic.net>)
Responses Re: View vs. Statement Query Plan  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
Curt Sampson <cjs@cynic.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

pgsql-general by date:

Previous
From: Oliver Jones
Date:
Subject: Updates failing yet saying they succeeded.
Next
From: Gregory Seidman
Date:
Subject: Re: Updates failing yet saying they succeeded.