I created a new database in Flexible Server and enabled the pgbouncer. When I run SHOW DATABASE, it only displays two databases. How to assign a newly created database to pgbouncer.please find the screenshot
I created one Azure PostgreSQL database Flexible server by enabling pgbouncer like below:-
I tried running SHOW DATABASES;
command in pgbouncer and received 2 default databases, Refer below:-
By default when pgbouncer does not include CREATE DATABASE command when I ran SHOW HELP;
Refer below:-
SHOW DATABASES will only show the currently applied connection limits to the databases, As the newly created database does not have any connection limit applied, It is not showing under SHOW DATABASES; result. In order for database to reflect you need to set the Connection limit parameter to the Database with Alter command.
I connected to testdb that I created and assigned a connection limit to the testdb like below:-
Create testdb:-
CREATE DATABASE testdb;
Connected to testdb Note- to connect any database to pgbouncer you need to use Port 6432 like below:-
psql "host=<potgresqlservername>.postgres.database.azure.com port=6432 dbname=testdb user=<username>password=<password> sslmode=require"
Altered testdb Database Connection limit:-
ALTER DATABASE testdb CONNECTION LIMIT 100;
Now, I connected to pgbouncer and ran SHOW DATABASES;
and got testdb in the result refer below:-