# sql: connection pool exhausted: too many connections

- **ID:** `go/sql-connection-pool-exhausted`
- **Domain:** go
- **Category:** resource_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

More concurrent database requests than available connections; pool max limit reached.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.20 | active | — | — |

## Workarounds

1. **** (90% success)
   ```
   Use connection pooling with SetMaxOpenConns and SetMaxIdleConns, and use context timeouts: db.SetMaxOpenConns(10); db.SetConnMaxLifetime(time.Minute)
   ```
2. **** (85% success)
   ```
   Implement a semaphore to limit concurrent queries: sem := make(chan struct{}, 10); sem <- struct{}{}; defer func(){<-sem}()
   ```

## Dead Ends

- **** — Unlimited connections can overwhelm database server. (60% fail)
- **** — May not be feasible; pool still limited. (50% fail)
