Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 79BE89FB458 for ; Thu, 12 Jul 2007 05:51:43 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 36450-03 for ; Thu, 12 Jul 2007 05:51:37 -0300 (ADT) X-Greylist: delayed 16:51:09.33618 by SQLgrey-1.7.5 Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.190]) by postgresql.org (Postfix) with ESMTP id 52F239FB456 for ; Thu, 12 Jul 2007 05:51:40 -0300 (ADT) Received: by nf-out-0910.google.com with SMTP id f5so4898nfh for ; Thu, 12 Jul 2007 01:51:35 -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=h8Pe6b1Y6H6rqUaJYbRYtbkH+LLJCdYbSRGAQ2fe4+dHgHuhw2Blt7bwDHssWYVBV0rB73yDh2IHFa6pwDbaWoBd2zJLeYLBdgRPMqhpfdPwzNfMwD4hfecLu6EmpfWBYOi9kMNRpmaBomwiuuxOmZlz1JsXkwazyoE8UHOcJnI= 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=jB+DYERpbZQCd1OQjLpAP+Z+gesW9/3Jx8UVQI8QIpq+xFmmSyCD6eG4qIKGp0AfzLu0Yx6d1O9IRzZL+7Eb5AnfCpssar5My65P7HaNcv0NB6NFk+c7iUhJhbIKAWntJT0IdE1BWXOpnjueEjw2fpBx/Y0x6QQOH7b53ansYoI= Received: by 10.82.190.2 with SMTP id n2mr229877buf.1184230295581; Thu, 12 Jul 2007 01:51:35 -0700 (PDT) Received: from ?192.168.1.33? ( [86.27.69.36]) by mx.google.com with ESMTP id d27sm7066822nfh.2007.07.12.01.51.32 (version=SSLv3 cipher=RC4-MD5); Thu, 12 Jul 2007 01:51:33 -0700 (PDT) Message-ID: <4695EB62.7060307@enterprisedb.com> Date: Thu, 12 Jul 2007 09:50:42 +0100 From: Heikki Linnakangas User-Agent: Icedove 1.5.0.10 (X11/20070329) MIME-Version: 1.0 To: =?UTF-8?B?TWFyY2luIFN0xJlwbmlja2k=?= CC: pgsql-performance@postgresql.org Subject: Re: one column from huge view References: In-Reply-To: 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/135 X-Sequence-Number: 25819 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