From: | Sean Davis <sdavis2(at)mail(dot)nih(dot)gov> |
---|---|
To: | Matt Helm <code(dot)name(dot)eric(at)gmail(dot)com>, <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: Efficiency of Views |
Date: | 2006-03-02 18:26:42 |
Message-ID: | C02CA312.735F%sdavis2@mail.nih.gov |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On 3/2/06 12:57 PM, "Matt Helm" <code(dot)name(dot)eric(at)gmail(dot)com> wrote:
> I have a table (call it T1) made up of a join from two other tables
> and a few calculated columns.
>
> Currently, T1 gets refreshed by manually calling a function that does
> the select on the join and then loops through each row doing an
> update / insert as needed.
>
> Obviously it would be nice to put this in a view so that I don't
> have to worry about someone forgetting to call the refresh function.
>
> My question (probably a common one):
>
> When I select a single row from the view using WHERE will
> the view build the calculated columns for every row regardless?
Nope. It does the right thing. Try creating the view you want and then do:
explain select .... From view where ...
Then try:
explain select ... FULL SELECT STATEMENT USED TO MAKE THE VIEW.
They will be the same, I think.
Sean
From | Date | Subject | |
---|---|---|---|
Next Message | Matt Helm | 2006-03-02 22:43:05 | Re: Efficiency of Views |
Previous Message | Andreas Kretschmer | 2006-03-02 18:22:45 | Re: Efficiency of Views |