X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 535EE9FA5DD for ; Sun, 11 Jun 2006 14:32:09 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 25088-02 for ; Sun, 11 Jun 2006 14:31:58 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by postgresql.org (Postfix) with ESMTP id BDFB79FA3D7 for ; Sun, 11 Jun 2006 14:31:58 -0300 (ADT) Received: from [2001:700:300:dc0f:216:3eff:fe40:5a47] (helo=trofast.sesse.net) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1FpTn2-0000BG-1w for pgsql-performance@postgresql.org; Sun, 11 Jun 2006 19:31:56 +0200 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1FpTn1-0002Pr-00 for ; Sun, 11 Jun 2006 19:31:55 +0200 Date: Sun, 11 Jun 2006 19:31:55 +0200 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: function not called if part of aggregate Message-ID: <20060611173155.GA9244@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <448C505C.2080504@modgraph-usa.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <448C505C.2080504@modgraph-usa.com> X-Operating-System: Linux 2.6.16trofastxen on a x86_64 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11+cvs20060403 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/118 X-Sequence-Number: 19475 On Sun, Jun 11, 2006 at 10:18:20AM -0700, Craig A. James wrote: > This works well, but it requires me to actually retrieve the function's > value 800 times. Is this actually a problem? > So I thought I'd be clever: > > select count(1) from (select foo_init(value) from foo_init_table order by > value_id) as foo; Why not just count(foo_init(value))? /* Steinar */ -- Homepage: http://www.sesse.net/