-
Notifications
You must be signed in to change notification settings - Fork 122
Open
Description
Problem
The application currently hardcodes database connection pool settings (SetMaxOpenConns(10)), which can cause issues in certain environments:
- Managed databases with connection limits (e.g., DigitalOcean) may have strict connection quotas
lib/pqdriver prepared statement conflicts: With connection pooling, users experience"pq: unnamed prepared statement does not exist"errors, especially on managed PostgreSQL instances (unnamed prepared statement does not exist ERROR on production/staging servers lib/pq#889)- No way to tune performance based on deployment environment
Ideal Solution (Long-term)
Switch to a more modern PostgreSQL driver that properly handles prepared statements with connection pooling, such as:
pgx- Actively maintained with better connection pooling supportpgxpool- Built specifically for connection pooling scenarios
Proposed Short-term Workaround
Add environment variables to make connection pool settings configurable:
PBW_DB_MAX_CONNS(default: 10)PBW_DB_MAX_IDLE_CONNS(default: 5)
This allows users to:
- Limit connections to match their database plan
- Set to 1 connection to work around
lib/pqprepared statement issues - Tune for their specific workload
Metadata
Metadata
Assignees
Labels
No labels