Skip to main content

Connection Pooling

Lordbase includes built-in PgBouncer connection pooling for all PostgreSQL databases.


What is Connection Pooling?

Connection pooling reuses database connections instead of opening a new one for every request. This dramatically improves performance and reduces resource consumption, especially in high-traffic applications.


How to Connect via PgBouncer

Simply use port 6432 instead of the default PostgreSQL port 5432:

postgresql://username:[email protected]:6432/db_name
tip

All connection details returned by the Lordbase API already point to the PgBouncer port. No additional configuration is needed.


Monitoring Pool Status

Pool Overview

curl -X GET https://api.lordbase.com/e/v1/developer/databases/{database_id}/pooling/ \
-H "Authorization: Bearer lb_pat_your_token"

Active Clients

curl -X GET https://api.lordbase.com/e/v1/developer/databases/{database_id}/pooling/clients/ \
-H "Authorization: Bearer lb_pat_your_token"

Server Connections

curl -X GET https://api.lordbase.com/e/v1/developer/databases/{database_id}/pooling/servers/ \
-H "Authorization: Bearer lb_pat_your_token"

Pool Health Check

curl -X GET https://api.lordbase.com/e/v1/pooling/health/ \
-H "Authorization: Bearer lb_pat_your_token"

Pool Metrics

MetricDescription
Active ClientsCurrent number of connected clients
Active ServersCurrent backend connections to PostgreSQL
Pool SizeTotal capacity of the connection pool
Wait QueueClients waiting for an available connection

Best Practices

PracticeDescription
Always use PgBouncerConnect via port 6432 for pooled connections
Limit app-side poolsReduce your ORM/framework connection pool size
Use transaction modePgBouncer defaults to transaction-level pooling
Monitor wait queuesHigh wait counts indicate pool exhaustion

Next Steps