Skip site navigation (1) Skip section navigation (2)

Re: one column from huge view

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: Marcin Stępnicki <mstepnicki(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: one column from huge view
Date: 2007-07-12 08:50:42
Message-ID: 4695EB62.7060307@enterprisedb.com (view raw or flat)
Thread:
Lists: pgsql-performance
Marcin Stępnicki wrote:
> Hello.
> 
> I've googled a bit but I think I can't match the keywords, so I thought
> I'll ask here:
> 
> 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.

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

In response to

Responses

pgsql-performance by date

Next:From: Marc CousinDate: 2007-07-12 08:55:07
Subject: Re: Weird row estimate
Previous:From: Marcin StępnickiDate: 2007-07-12 08:33:45
Subject: one column from huge view

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group