Re: retriving views name - Mailing list pgsql-general

From Tom Lane
Subject Re: retriving views name
Date
Msg-id 9777.1003244372@sss.pgh.pa.us
Whole thread Raw
In response to Re: retriving views name  (Alessio Bragadini <alessio@albourne.com>)
List pgsql-general
Alessio Bragadini <alessio@albourne.com> writes:
> Tom Lane wrote:
>> One must wonder why you create views at all, if you don't intend them
>> to stick around for long.  Why not just write out the SELECTs in full?
>> (If you think there's some performance benefit to using a view, you are
>> quite mistaken.)

> There are no cached query plans in any way?

Certainly none associated with views.  Views would make a very poor
basis for caching plans, since they typically form only a part of
the eventual query.  Example: suppose you write

    create view v as select * from foo;

    select * from v where indexedcol = 42;

You'd be fairly unhappy if the system were unable to use an indexscan
over foo.indexedcol for this query, no?  But a plan associated with the
bare view definition couldn't exploit this possibility, because the
potential to use that index doesn't arise in the context of the view
itself, only in the context of the complete query.

            regards, tom lane

pgsql-general by date:

Previous
From: "Nadeem Akhtar"
Date:
Subject: Transaction not working.
Next
From: "Stefan Lindner"
Date:
Subject: system maintained keys