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.94.2) (envelope-from ) id 1ueUUg-00AKpy-4k for pgsql-general@arkaria.postgresql.org; Wed, 23 Jul 2025 08:06:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ueUUf-000jll-7J for pgsql-general@arkaria.postgresql.org; Wed, 23 Jul 2025 08:06:29 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ueUUe-000jlc-TJ for pgsql-general@lists.postgresql.org; Wed, 23 Jul 2025 08:06:29 +0000 Received: from cloud.gatewaynet.com ([185.90.37.94]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ueUUb-000Nt3-2e for pgsql-general@lists.postgresql.org; Wed, 23 Jul 2025 08:06:28 +0000 Content-Type: multipart/alternative; boundary="------------Rj0YPAEcGN0zDFLoJ6f21iXL" Message-ID: Date: Wed, 23 Jul 2025 09:06:24 +0100 MIME-Version: 1.0 Subject: Re: PgBouncer Prepared Statement ERROR To: KK CHN , pgsql-general@lists.postgresql.org References: Content-Language: en-US From: Achilleas Mantzios In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------Rj0YPAEcGN0zDFLoJ6f21iXL Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 7/18/25 13:52, KK CHN wrote: > Hi , > > I am getting error when using  PgBouncer(1.23.1 ) with Postgres 16  > (RedHAT 9.4) > > 2025-07-18 00:00:00 IST ERROR:  prepared statement "S_243" does not exist > 2025-07-18 00:00:03 IST ERROR:  prepared statement "S_205" does not exist > 2025-07-18 00:00:03 IST ERROR:  prepared statement "S_206" does not exist > 2025-07-18 00:00:03 IST ERROR:  prepared statement "S_207" does not exist > > > How to avoid these prepared statement Errors ? > > Before you start considering prepared statements, via pgbouncer, and testing them to see if you benefit from them, you may at first disable them all together. Just set prepareThreshold=0 in the connection url, or params. > Any hints most welcome, > Krishane > > > config as follows > [root@pgbouncer ~]# grep ^[^';;;']  /usr/local/etc/pgbouncer.ini > [databases] > transaction_db = host=dbmain.erss.in port=5444 > dbname= transaction_db > mgt_db = host=dbmain.erss.in port=5444 > dbname=mgt_db > .................................... > tsp_db = host=dbmain.erss.in port=5444 > dbname=tsp_db > [users] > [pgbouncer] > logfile = /var/log/pgbouncer/pgbouncer.log > pidfile = /var/run/pgbouncer/pgbouncer.pid > listen_addr = * > listen_port = 5444 > auth_type = md5 > auth_file = /usr/local/etc/pgbouncer.users > admin_users = myuser > stats_users =  status_user, > pool_mode = transaction > server_reset_query = DISCARD ALL > server_reset_query_always = 1 > ignore_startup_parameters = extra_float_digits, options, > statement_timeout, idle_in_transaction_session_timeout > max_client_conn = 5000 > default_pool_size = 20 > min_pool_size = 10 > reserve_pool_size = 10 > reserve_pool_timeout = 5 > max_db_connections = 900 > max_user_connections = 800 > server_lifetime = 3600 > server_idle_timeout = 60000 > [root@pgbouncer ~]# > --------------Rj0YPAEcGN0zDFLoJ6f21iXL Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

On 7/18/25 13:52, KK CHN wrote:

Hi ,

I am getting error when using  PgBouncer(1.23.1 ) with  Postgres 16  (RedHAT 9.4)

2025-07-18 00:00:00 IST ERROR:  prepared statement "S_243" does not exist
2025-07-18 00:00:03 IST ERROR:  prepared statement "S_205" does not exist
2025-07-18 00:00:03 IST ERROR:  prepared statement "S_206" does not exist
2025-07-18 00:00:03 IST ERROR:  prepared statement "S_207" does not exist


How to avoid these prepared statement Errors ?   



Before you start considering prepared statements, via pgbouncer, and testing them to see if you benefit from them, you may at first disable them all together.

Just set prepareThreshold=0 in the connection url, or params.


Any hints most welcome,
Krishane

 

config as follows
[root@pgbouncer ~]# grep ^[^';;;']  /usr/local/etc/pgbouncer.ini
[databases]
transaction_db = host=dbmain.erss.in port=5444 dbname= transaction_db
mgt_db = host=dbmain.erss.in port=5444 dbname=mgt_db
....................................
tsp_db = host=dbmain.erss.in port=5444 dbname=tsp_db
[users]
[pgbouncer]
logfile = /var/log/pgbouncer/pgbouncer.log
pidfile = /var/run/pgbouncer/pgbouncer.pid
listen_addr = *
listen_port = 5444
auth_type = md5
auth_file = /usr/local/etc/pgbouncer.users
admin_users = myuser
stats_users =  status_user,
pool_mode = transaction
server_reset_query = DISCARD ALL
server_reset_query_always = 1
ignore_startup_parameters = extra_float_digits, options, statement_timeout, idle_in_transaction_session_timeout
max_client_conn = 5000
default_pool_size = 20
min_pool_size = 10
reserve_pool_size = 10
reserve_pool_timeout = 5
max_db_connections = 900
max_user_connections = 800
server_lifetime = 3600
server_idle_timeout = 60000
[root@pgbouncer ~]#

--------------Rj0YPAEcGN0zDFLoJ6f21iXL--