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 1iEy17-0005qQ-OG for pgsql-docs@arkaria.postgresql.org; Mon, 30 Sep 2019 15:55:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iEy15-0008KT-12 for pgsql-docs@arkaria.postgresql.org; Mon, 30 Sep 2019 15:55:15 +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 1iEy14-0008K9-Pn for pgsql-docs@lists.postgresql.org; Mon, 30 Sep 2019 15:55:14 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iEy0x-000058-HB for pgsql-docs@postgresql.org; Mon, 30 Sep 2019 15:55:14 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1iEy0v-0005do-Ld for pgsql-docs@postgresql.org; Mon, 30 Sep 2019 11:55:05 -0400 Date: Mon, 30 Sep 2019 11:55:05 -0400 From: Bruce Momjian To: PostgreSQL-documentation Subject: PREPARE and GUC plan_cache_mode Message-ID: <20190930155505.GA21095@momjian.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + As you are, so once was I. As I am, so you will be. + + Ancient Roman grave inscription +