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 1eyl6V-0004Z8-SG for pgsql-general@arkaria.postgresql.org; Wed, 21 Mar 2018 21:17:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eyl6U-0008QJ-So for pgsql-general@arkaria.postgresql.org; Wed, 21 Mar 2018 21:17:02 +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.89) (envelope-from ) id 1eyl6U-0008Q1-5h for pgsql-general@lists.postgresql.org; Wed, 21 Mar 2018 21:17:02 +0000 Received: from omr-m008e.mx.aol.com ([204.29.186.7]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eyl6Q-0000ZJ-3T for pgsql-general@postgresql.org; Wed, 21 Mar 2018 21:17:01 +0000 Received: from mtaomg-mae02.mx.aol.com (mtaomg-mae02.mx.aol.com [172.26.254.144]) by omr-m008e.mx.aol.com (Outbound Mail Relay) with ESMTP id 102DE380019A; Wed, 21 Mar 2018 17:16:55 -0400 (EDT) Received: from core-aax03d.mail.aol.com (core-aax03.mail.aol.com [10.76.5.65]) by mtaomg-mae02.mx.aol.com (OMAG/Core Interface) with ESMTP id C34C238000081; Wed, 21 Mar 2018 17:16:54 -0400 (EDT) Received: from 69.248.80.3 by webjas-vac241.srv.aolmail.net (10.96.19.244) with HTTP (WebMailUI); Wed, 21 Mar 2018 17:16:53 -0400 Date: Wed, 21 Mar 2018 17:16:54 -0400 From: Rakesh Kumar To: theophilusx@gmail.com, pgsql-general@postgresql.org Message-Id: <1624a6bfb0c-c8d-9692@webjas-vac241.srv.aolmail.net> In-Reply-To: <87o9jhjfv2.fsf@gmail.com> References: <87o9jhjfv2.fsf@gmail.com> Subject: Re: Prepared statements MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-MB-Message-Source: WebUI X-MB-Message-Type: User X-Mailer: JAS STD X-Originating-IP: [69.248.80.3] x-aol-global-disposition: G DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mx.aol.com; s=20150623; t=1521667014; bh=9pTUeCtCMBH2FmNi37ti/GEfPbvwIFE+OwFr/9YT2RU=; h=From:To:Subject:Message-Id:Date:MIME-Version:Content-Type; b=QEMfo5jyF2x+7HAmWKyXwXnd2ktFcTs4s5VYIonKHzj4TTzVsIlHuBVM51iGjtL2B y228h2bAn8qQPohB6AqHfzXvXMGmxp3CrnfGL/puAs7Z5+ct3K+vQ21G6EIHFH3iRN mdaGyBCsURLG0SAauhzzkJn6328ED9aD1quysnEw= x-aol-sid: 3039ac1afe905ab2cbc612c4 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > For example, the planner may be able to > more easily recognise a statement and reuse an existing plan rather than > re-planning the query. This is a double edged sword. Reuse an existing plan can be bad in those cases where the data distribution is not suitable for the current plan. This has been the achilles heel of many RDBMS. Only in Oracle 12c there are options to let the planner change existing plan by peeking into the parameter values (supplied in ? of prepare) and checking it against the distribution.