Re: one column from huge view

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: Marcin Stępnicki <mstepnicki(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: one column from huge view
Date: 2007-07-12 12:55:43
Message-ID: 469624CF.5010803@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Michael Fuhr wrote:
> On Thu, Jul 12, 2007 at 09:50:42AM +0100, Heikki Linnakangas wrote:
>> Marcin Stępnicki wrote:
>>> Let's say I've got a view with 100 columns and 1mln rows; some of them are
>>> calculated "on the fly". For some reason I want only one column from
>>> this view:
>>>
>>> select col1 from huge_view;
>>>
>>> Now, does PostgreSQL skip all the calculations from other columns and
>>> executes this query faster then select * from huge_view?
>> In simple cases, yes. But for example, if you have a LEFT OUTER JOIN in
>> the view, the join is performed even if your query doesn't return any
>> columns from the outer relation. Also, if the calculation contains
>> immutable functions, it's not skipped.
>
> Don't you mean "if the calculation contains VOLATILE functions,
> it's not skipped"?

Yes, thanks for the correction.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2007-07-12 14:27:03 Re: pg_restore causes 100
Previous Message Michael Fuhr 2007-07-12 12:51:36 Re: one column from huge view