Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UGE0I-0003JD-BI for pgsql-performance@arkaria.postgresql.org; Thu, 14 Mar 2013 19:39:54 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UGE0H-0000ek-RI for pgsql-performance@arkaria.postgresql.org; Thu, 14 Mar 2013 19:39:53 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UGE0H-0000ef-1k for pgsql-performance@postgresql.org; Thu, 14 Mar 2013 19:39:53 +0000 Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UGE0F-0005ZT-MT for pgsql-performance@postgresql.org; Thu, 14 Mar 2013 19:39:52 +0000 Received: from mfilter12-d.gandi.net (mfilter12-d.gandi.net [217.70.178.129]) by relay4-d.mail.gandi.net (Postfix) with ESMTP id 8BE01172067; Thu, 14 Mar 2013 20:39:29 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter12-d.gandi.net Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by mfilter12-d.gandi.net (mfilter12-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id S3tlTXEcPb4a; Thu, 14 Mar 2013 20:39:28 +0100 (CET) X-Originating-IP: 98.27.58.255 Received: from [192.168.10.146] (cpe-098-027-058-255.nc.res.rr.com [98.27.58.255]) (Authenticated sender: adsend@dunslane.net) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id BCAF0172074; Thu, 14 Mar 2013 20:39:27 +0100 (CET) Message-ID: <5142276D.10406@dunslane.net> Date: Thu, 14 Mar 2013 15:39:25 -0400 From: Andrew Dunstan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0 MIME-Version: 1.0 To: =?UTF-8?B?QXJ0dXIgWmFqxIVj?= CC: pgsql-performance@postgresql.org Subject: Re: Speed of EXCECUTE in PL/PGSQL References: <035b01ce20e9$38ec92a0$aac5b7e0$@ang.com.pl> In-Reply-To: <035b01ce20e9$38ec92a0$aac5b7e0$@ang.com.pl> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On 03/14/2013 03:22 PM, Artur Zaj=C4=85c wrote: > > Why speed of executing (or planning) some very simple query from=20 > string in pl/pgsql is dependent from whole query or why =E2=80=9CFOR r IN= =20 > EXECUTE q=E2=80=9D is significally slower from =E2=80=9CFOR r IN query=E2= =80=9D? > > The whole point of EXECUTE is that it's reparsed and planned each time.=20 You should expect it to be quite a bit slower, and avoid using EXECUTE=20 wherever possible. cheers andrew --=20 Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance