Last Updated: May 22, 2026
A *sql.DB is a pool of connections, not a single connection. That distinction matters because every query you run borrows a connection, uses it, and returns it. This chapter covers the four knobs that control the pool, how a query acquires and releases a connection, what happens when the pool runs dry, how to tune the settings for a real workload, and how to read db.Stats() to spot problems before they become outages.