Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iEyAl-0006F1-8Z for pgsql-docs@arkaria.postgresql.org; Mon, 30 Sep 2019 16:05:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iEyAk-0006ud-1M for pgsql-docs@arkaria.postgresql.org; Mon, 30 Sep 2019 16:05:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iEyAj-0006uT-QY for pgsql-docs@lists.postgresql.org; Mon, 30 Sep 2019 16:05:13 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iEyAh-0001By-Kg for pgsql-docs@postgresql.org; Mon, 30 Sep 2019 16:05:13 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x8UG57sd013156; Mon, 30 Sep 2019 12:05:07 -0400 From: Tom Lane To: Bruce Momjian cc: PostgreSQL-documentation Subject: Re: PREPARE and GUC plan_cache_mode In-reply-to: <20190930155505.GA21095@momjian.us> References: <20190930155505.GA21095@momjian.us> Comments: In-reply-to Bruce Momjian message dated "Mon, 30 Sep 2019 11:55:05 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <13154.1569859507.1@sss.pgh.pa.us> Date: Mon, 30 Sep 2019 12:05:07 -0400 Message-ID: <13155.1569859507@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Bruce Momjian writes: > Our current docs have this text for PREPARE: > 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. Once a generic plan is chosen, it > is used for the remaining lifetime of the prepared statement. Using > EXECUTE values which are rare in columns with many duplicates can > generate custom plans that are so much cheaper than the generic > plan, even after adding planning overhead, that the generic plan > might never be used. > There is no mention that PG 12's plan_cache_mode can modify this > behavior. I think this needs a doc patch. Yeah, agreed. I can do it, or do you want to? regards, tom lane