Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 90B739FB9F7 for ; Thu, 12 Jul 2007 09:56:49 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 50674-06 for ; Thu, 12 Jul 2007 09:56:31 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.168]) by postgresql.org (Postfix) with ESMTP id 596579FB5F8 for ; Thu, 12 Jul 2007 09:56:41 -0300 (ADT) Received: by ug-out-1314.google.com with SMTP id a2so355030ugf for ; Thu, 12 Jul 2007 05:56:36 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=ch52tA+fIwD11fZ+9MoBeEH35J+NDXdTyXueKKzw7MTMDWb+PSP5l2wpTfY2DUNBOnC+dHlNVb+2lYhw77SLfKXGtGCs71KG1qx7vy/dwb8NukQltfjgJfiwigNf/k+wqHsun27Qzj7d6whYOzBlOGHmLejT1dR6lyAcu7SjbU8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=e4p9XU2tRfO0tmq2Vh+GX7C0FaAgKP9fYMU0N+r7fuJMuYvkEHD2gI+cmgilNbI49xofj4ZVBK6IR9bhgc47dYoMMBwZBda3PzhKcT6Q2gLURGqfM0S9paXjs3NpbnnY4fEMjz/eoNRh1JORVwg6+1NK7H/hjVCX8ICFuhQHL28= Received: by 10.66.244.6 with SMTP id r6mr1199202ugh.1184244996917; Thu, 12 Jul 2007 05:56:36 -0700 (PDT) Received: from ?172.24.32.105? ( [62.232.55.118]) by mx.google.com with ESMTPS id q40sm1750072ugc.2007.07.12.05.56.33 (version=SSLv3 cipher=RC4-MD5); Thu, 12 Jul 2007 05:56:34 -0700 (PDT) Message-ID: <469624CF.5010803@enterprisedb.com> Date: Thu, 12 Jul 2007 13:55:43 +0100 From: Heikki Linnakangas User-Agent: Icedove 1.5.0.10 (X11/20070329) MIME-Version: 1.0 To: Michael Fuhr CC: =?UTF-8?B?TWFyY2luIFN0xJlwbmlja2k=?= , pgsql-performance@postgresql.org Subject: Re: one column from huge view References: <4695EB62.7060307@enterprisedb.com> <20070712125136.GA37198@winnie.fuhr.org> In-Reply-To: <20070712125136.GA37198@winnie.fuhr.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/141 X-Sequence-Number: 25825 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