Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1krT9b-0007m0-HG for psycopg@arkaria.postgresql.org; Mon, 21 Dec 2020 21:55:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1krT9a-0002hM-44 for psycopg@arkaria.postgresql.org; Mon, 21 Dec 2020 21:55:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1krT9Z-0002hE-Uw for psycopg@lists.postgresql.org; Mon, 21 Dec 2020 21:55:41 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1krT9X-0000b4-JX for psycopg@postgresql.org; Mon, 21 Dec 2020 21:55:40 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 5BBCAA5C; Mon, 21 Dec 2020 16:55:38 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 21 Dec 2020 16:55:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=3 /5jsvr2mON9gSkaVxcoYa0mOpTawHeOOWtkMEWQSsI=; b=hvDaz244cfmPIA0YD aR7KSr7IA3Zzqn2q7JZuo9q/bFLQMf+qvWeX2YSQOB2MXsUXKtjFvX1sGgL2ZwG/ 7dncwFPoudLp1bqDEMPWGng++hsgXBUXjNW44pBYBNUVYkOEda3O3EykM8vI2XwX XuV/pBEpvqWzlZm/RTvkrvoeO5VeKSJv1JAHNk/tdMEv+VZ163Kl0kEC09qLQH9k nDNcTpzyrguR/rbQASFVwhb2OgZoq2PVeso07aZt/8qWMsW1q4TRYUx2XpI/Lc7/ W5bsXPnIC9/HESlxm33oOjVVxfqyFdVOsLXzm6WJZ8bRbYubm/OsCovk3xjrR1ch /KL3A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=3/5jsvr2mON9gSkaVxcoYa0mOpTawHeOOWtkMEWQS sI=; b=UBAom+jG73SF7MHfVbfKaBVuHSeEfyAD0Ms8FqgqJWgMPVjUC1gKgtE0n MnRIS3WJBSZmUkDtwhkhSortIGnefUKUd3W5369xgZl+QsHMH4iMykqhhnd5tLfm NnnEpC+bHqHWHFlolKURA/jqJ8sUuRhS6EnDEKip7clDa5aoPt3G03uRHX1Vh1/g eG2BIA967WKBSkfapPSVRWBT6Stu0tscMU0Kn5Liv6BzJz3MWP4xqYGohrg3IiFZ OzE+LPWEEy6iApEaVO4RkbLdfsO62iSN4xdFtqYJGQvmKrYE4J6CyoozWNGE5OTu 7xFA5VGhVlQ/QIPzL/o199RKJywhA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvddtvddgudehkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefuvfhfhffkffgfgggjtgfgsehtjeertddtfeejnecuhfhrohhmpeetughr ihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtg homheqnecuggftrfgrthhtvghrnhepteejvdetffejuedvleeifeefheeutdfhgfdvhffh hfekvdduveegvdejudefgfevnecukfhppeejhedrudejvddrudegrddujeenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhl rghvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Received: from [192.168.1.4] (75-172-14-17.tukw.qwest.net [75.172.14.17]) by mail.messagingengine.com (Postfix) with ESMTPA id 4CCCF108005F; Mon, 21 Dec 2020 16:55:37 -0500 (EST) Subject: Re: psycopg3, prepared statements To: Daniele Varrazzo Cc: psycopg@postgresql.org References: <25a137a0-9ad3-bb9f-b008-263dcc81a645@aklaver.com> From: Adrian Klaver Message-ID: <331f273f-fc13-8d80-b209-c94c0960268b@aklaver.com> Date: Mon, 21 Dec 2020 13:55:36 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 12/21/20 12:26 PM, Daniele Varrazzo wrote: > On Mon, 21 Dec 2020 at 16:02, Adrian Klaver wrote: > > > I mistakenly replied Adrian privately. Following, his reply. > > I think so. Personally, I prefer the two step approach as I am becoming > less and less enthusiastic about hidden 'magic'. To that end a > global(maybe connection) setting that would disable prepare would be nice. > > ---- > > To which, 1) thank you very much, Adrian, for the plpython pointer, > I'll take a look at it. > > 2) About disabling the automatic prepare: the mechanism I have in mind > is to set prepare_threshold to None on the connection instance; So the above is something the user would have to do on each connection? > however we could make sure to have the default attribute defined on > the class: this way who really hates the idea of prepared statements > can be cheeky and set `psycopg3.Connection.prepare_threshold = None` I could get behind that. This all may be premature optimization on my part. As long as there is some way to turn it off at some level I could live with it. > instead of `myconn.prepare_threshold`... More seriously, if there is a > large base of people who think that something can go wrong with > prepared statement we can either provide a better interface to control > it globally or to have the feature opt-in. > > > -- Daniele > -- Adrian Klaver adrian.klaver@aklaver.com