Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 34E8CDE314D for ; Tue, 3 Apr 2012 11:30:33 -0300 (ADT) Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SF4kd-0000gA-54 for pgsql-performance@postgresql.org; Tue, 03 Apr 2012 14:30:32 +0000 X-Originating-IP: 217.70.178.131 Received: from mfilter11-d.gandi.net (mfilter11-d.gandi.net [217.70.178.131]) by relay4-d.mail.gandi.net (Postfix) with ESMTP id 6957F1720A1; Tue, 3 Apr 2012 16:30:04 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter11-d.gandi.net Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by mfilter11-d.gandi.net (mfilter11-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id tZt22ppmNHYd; Tue, 3 Apr 2012 16:30:03 +0200 (CEST) X-Originating-IP: 98.27.54.176 Received: from [192.168.10.146] (cpe-098-027-054-176.nc.res.rr.com [98.27.54.176]) (Authenticated sender: adsend@dunslane.net) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 67105172092; Tue, 3 Apr 2012 16:30:02 +0200 (CEST) Message-ID: <4F7B0968.5000805@dunslane.net> Date: Tue, 03 Apr 2012 10:30:00 -0400 From: Andrew Dunstan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1 MIME-Version: 1.0 To: Robert Haas CC: Igor Schtein , pgsql-performance@postgresql.org Subject: Re: Performance of SQL Function versus View References: <021a01ccf722$059a2a80$10ce7f80$@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201204/17 X-Sequence-Number: 46663 On 04/03/2012 10:21 AM, Robert Haas wrote: > > You should probably test this in your environment, but I'd expect the > view to be better. Wrapping logic inside PL/pgsql functions > needlessly rarely turn outs to be a win. Right, But also note that auto_explain is very useful in getting plans and times of queries nested in functions which can't easily be got otherwise. cheers andrew