Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wSIuP-003684-2T for pgsql-hackers@arkaria.postgresql.org; Wed, 27 May 2026 18:23:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wSIuN-009BG9-2P for pgsql-hackers@arkaria.postgresql.org; Wed, 27 May 2026 18:23:12 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wSIuN-009BFx-0G for pgsql-hackers@lists.postgresql.org; Wed, 27 May 2026 18:23:12 +0000 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wSIuJ-000000013E4-1BVM for pgsql-hackers@postgresql.org; Wed, 27 May 2026 18:23:11 +0000 Received: by mail-ot1-x32a.google.com with SMTP id 46e09a7af769-7e5fd39cf11so4976936a34.0 for ; Wed, 27 May 2026 11:23:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779906186; x=1780510986; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=otxGCCOTwe4ghBevWjyyewW4qCtH47soyH6MrE+RxcY=; b=pMPHR+oSCLPPSqJ0AtlSl8FUawnkveyKAniPFIFLHJF4z1y1S1HOCZyS2zaOSZMcGX 4jdohmyqwsE27aJjWJSKSoJe5sNVPo+RK6XCy43Z3ZF4iy86shSoaLkdoqMBHVUg8mhJ dLjZBGU3o5VOc0U0LDexIQf1AjbEf5NLgtEYqCbWwn4Z9Qy24vgJQcqUaM/+60uteouJ 8kQnmok1tb6qgtWwA8GRNBPQCvKWDEM8ddsrP0SEv4nKrPKw4L7XvXo7eirm0xCU7nFL EjFQTB6K1E6XPw9UfqdLmoWdRbJBpXLKODxaDKchAj8DzaGw6E0vN/KpgNZ538whFB1W +Htg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779906186; x=1780510986; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=otxGCCOTwe4ghBevWjyyewW4qCtH47soyH6MrE+RxcY=; b=p0dFTsSlMl0RhnbwpGL/enPmGuWvGnGKl/w1ueCPEAFs7RDM3p1M772+vuGJwPN5FI kVqY9GMnNMMd9naLOnETUaqfQx9LPRw+fyMyDYyMVPI3qxaJDp6J8NW6Z33//BLwDsgv oAJsdBw3p5LDpst2/UkqBoF1yqWxhHUVmbOaIq3TEdapVeaKxDLc9kC1c6Z5+ydBGHMc p1n6GXva3tolEamgBt4TrmHzZ7zBome9t5s+giEDcHQJu4uDAKTWDTHpqCg5O5ERXmgf GxG14yvV3iLEq7hzkdwzU7fjHFI/y6GImM/uJbJsE0nQijO/v3PmyZE6N6aUUS8iLGT2 JY9Q== X-Gm-Message-State: AOJu0YxQphH7QH389dsOdzstG47Xhku7tzXJ1+SK/CQsI+2wh6GQfKl4 rHPpMLr4RBSzvpkO/k98YUCeZEhtuY21FFPt9pSPOlhrCLAf/jk4AQyD5qR9Jg== X-Gm-Gg: Acq92OFJQgUaB2lI/isY8lTOWI7/uZTsi0vmAa4Wq6vuLdJ/0L5OHee3sGx5M5WLBaL xyYkf/fyJh5tLmZvkqOyynAYMQeA0A4lKRatikyC9RWls+iivI/7lQ/TZkMb5kDm6DhmaVyQ4zk Hrrakcphi1aeeg1s47H4OyizjLlSlsXXL4OnNELd4p7W7qSgAscQ9rpwMmhoj8zaiw2kktMxmLq ukb+kCgbXgTilwC8YTLuoPHwTyCOyPHxeuiTVoJn9ydUeaTu3g6kqXHxQup96q9EgWXuwe8bW8A WYJVNfQMJP3TL6CQOaNEVL11kV0yl5aUjupcAiZ0hFfVYsf4YV3WyjFmnkmR1AvAMgNUK7f57na gFRV1tTDevN3JTdverLnb/PchOe9AqBMRGXcPc+0FXiem8J+KEVhQ1c7ML3GSSrksTsipRUVhRV K2HE3SJssOPL5ZVYBuSUPUAT1Y63q2u8g6udqzlahc/YVcHNJOFhz7D1MuvkrIekZ1RKGZYGc7l YdLr892ohjo34aGY2BtDg== X-Received: by 2002:a05:6830:350a:b0:7d7:f638:7a03 with SMTP id 46e09a7af769-7e5fecab11emr14650774a34.10.1779906186462; Wed, 27 May 2026 11:23:06 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7e6064828e6sm12212817a34.7.2026.05.27.11.23.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 May 2026 11:23:05 -0700 (PDT) Date: Wed, 27 May 2026 13:23:04 -0500 From: Nathan Bossart To: Jelte Fennema-Nio Cc: PostgreSQL-development Subject: Re: future of PQfn() Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="NDf4SqMA2rj1ZNJ4" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --NDf4SqMA2rj1ZNJ4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, May 26, 2026 at 11:36:49PM +0200, Jelte Fennema-Nio wrote: > Could you share the simple LO test you were running here and/or rerun it > with this patch applied? I'd love to know if the patch reduces the > slowdown significantly, or if something else is the bottleneck. The test is just: int main() { PCconn *conn = PQsetdb(NULL, NULL, NULL, NULL, "postgres"); for (int i = 0; i < 1000000; i++) lo_create(conn, i); for (int i = 0; i < 1000000; i++) lo_unlink(conn, i); } Before applying your patch -> 0.457 seconds (best of ~10) After applying your patch -> 0.444 seconds (best of ~10) For reference, HEAD runs this test in 0.319 seconds. I've attached my work-in-progress patches here, in case you're interested. 0001 switches the frontend LO interface to use prepared statements, and 0002 removes PQfn() entirely. 0003 applies on top of those two and switches the frontend LO interface to use PQexecParams() instead. -- nathan --NDf4SqMA2rj1ZNJ4 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0001-stop-using-PQfn-in-libpq-s-LO-interface.patch