# error: sql: connection pool exhausted

- **ID:** `go/sql-max-open-connections-exceeded`
- **Domain:** go
- **Category:** resource_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

连接池中的连接数达到最大值，且所有连接都在使用中。

## Version Compatibility

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

## Workarounds

1. **** (90% success)
   ```
   设置合理池大小：
db.SetMaxOpenConns(50)
db.SetMaxIdleConns(10)
db.SetConnMaxLifetime(time.Hour)
   ```
2. **** (95% success)
   ```
   确保所有连接关闭：
defer rows.Close()
defer stmt.Close()
   ```

## Dead Ends

- **** — 数据库服务器可能过载。 (70% fail)
- **** — 导致连接泄漏，更快耗尽。 (90% fail)
