Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aLFG0-0006ig-Jw for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Jan 2016 19:14:28 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aLFG0-00058i-4k for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Jan 2016 19:14:28 +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_SHA384:256) (Exim 4.84) (envelope-from ) id 1aLFFz-00058c-MW for pgsql-hackers@postgresql.org; Mon, 18 Jan 2016 19:14:27 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aLFFw-0007dh-HK for pgsql-hackers@postgresql.org; Mon, 18 Jan 2016 19:14:27 +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 u0IJEBlV006648; Mon, 18 Jan 2016 14:14:11 -0500 From: Tom Lane To: Bruce Momjian cc: Vladimir Sitnikov , Andres Freund , Marko Tiikkaja , Pavel Stehule , Albe Laurenz , PostgreSQL-development , Dave Cramer Subject: Re: Fwd: [JDBC] Re: 9.4-1207 behaves differently with server side prepared statements compared to 9.2-1102 In-reply-to: <20160118185522.GN31313@momjian.us> References: <895FBF7B-D59B-4F58-A8B7-4F78C6A1D527@anarazel.de> <5696604E.2030903@joh.to> <569660D9.7010107@joh.to> <20160113144318.7jcsd5wldolczjb5@alap3.anarazel.de> <31259.1452700038@sss.pgh.pa.us> <20160118185522.GN31313@momjian.us> Comments: In-reply-to Bruce Momjian message dated "Mon, 18 Jan 2016 13:55:22 -0500" Date: Mon, 18 Jan 2016 14:14:11 -0500 Message-ID: <6647.1453144451@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Bruce Momjian writes: > I never understood why we don't just keep the selectivity estimates of > previous plans and just reuse the plan if the selectivity estimates are > similar. Isn't parameter selectivity the only thing that distinguishes > on plan with parameter from another? > Checking selectivity estimates must be cheaper than replanning. This > could be done at the second use of the prepared plan, and maybe for all > plan reuses, rather than waiting for five and then perhaps getting this > bad behavior. You're imagining that a selectivity recheck could be separated out from the rest of the planner. That's nowhere near feasible, IMO. Even if it were, what would we do with it? There's no reliable way to determine whether X% change in one or another selectivity number would change the selected plan, other than by redoing practically all of the planning work. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers