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
| Metric | Description |
|---|---|
| Active Clients | Current number of connected clients |
| Active Servers | Current backend connections to PostgreSQL |
| Pool Size | Total capacity of the connection pool |
| Wait Queue | Clients waiting for an available connection |
Best Practices
| Practice | Description |
|---|---|
| Always use PgBouncer | Connect via port 6432 for pooled connections |
| Limit app-side pools | Reduce your ORM/framework connection pool size |
| Use transaction mode | PgBouncer defaults to transaction-level pooling |
| Monitor wait queues | High wait counts indicate pool exhaustion |
Next Steps
- Metrics — Monitor database resource usage
- Query Analytics — Analyze query performance