Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gFndr-0005cO-3Z for pgsql-general@arkaria.postgresql.org; Thu, 25 Oct 2018 21:58:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gFndp-0001bS-5a for pgsql-general@arkaria.postgresql.org; Thu, 25 Oct 2018 21:58:09 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gFndo-0001W3-Pa for pgsql-general@lists.postgresql.org; Thu, 25 Oct 2018 21:58:08 +0000 Received: from smtp.burggraben.net ([2a01:4f8:140:50a2::3:1]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gFndl-0007B7-CL for pgsql-general@lists.postgresql.org; Thu, 25 Oct 2018 21:58:07 +0000 Received: from localhost (localhost [127.0.0.1]) by smtp.burggraben.net (Postfix) with ESMTP id 278EB6002F4 for ; Thu, 25 Oct 2018 23:58:02 +0200 (CEST) X-Spam-Scanned: by amavisd-new at exwg.net Received: from smtp.burggraben.net ([127.0.0.1]) by localhost (ns.burggraben.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3ki-KvAHTzSI for ; Thu, 25 Oct 2018 23:57:50 +0200 (CEST) Received: from squirrel.exwg.net (unknown [88.157.232.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "squirrel.exwg.net", Issuer "Christoph Moench-Tegeder" (verified OK)) by smtp.burggraben.net (Postfix) with ESMTPS for ; Thu, 25 Oct 2018 23:57:50 +0200 (CEST) Received: by squirrel.exwg.net (Postfix, from userid 1000) id AF97C25A580; Thu, 25 Oct 2018 23:57:49 +0200 (CEST) Date: Thu, 25 Oct 2018 23:57:49 +0200 From: Christoph Moench-Tegeder To: pgsql-general@lists.postgresql.org Subject: Re: rw_redis_fdw: SQL Errors when statement is within a function Message-ID: <20181025215749.6yy3aparryceuker@squirrel.exwg.net> References: <20181025101948.r2hsnsm2ysn7q3ic@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ## GPT (gptmailinglists@gmail.com): > So, this kind of switch after a few goes is a normal behavior or > something unexpected which will change in future? It's expected, and even documented (when you look at the user-level interface): https://www.postgresql.org/docs/current/static/sql-prepare.html Prepared statements can use generic plans rather than re-planning with each set of supplied EXECUTE values. This occurs immediately for prepared statements with no parameters; otherwise it occurs only after five or more executions produce plans whose estimated cost average (including planning overhead) is more expensive than the generic plan cost estimate. Regards, Christoph -- Spare Space.