You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: connection-pool.md
+1
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,7 @@ There is a basic connection pool in the `database/sql` package. There isn't a
7
7
lot of ability to control or inspect it, but here are some things you might find
8
8
useful to know:
9
9
10
+
* Connection pooling means that executing two consecutive statements on a single database might open two connections and execute them separately. It is fairly common for programmers to be confused as to why their code misbehaves. For example, `LOCK TABLES` followed by an `INSERT` can block because the `INSERT` is on a connection that does not hold the table lock.
10
11
* Connections are created when needed and there isn't a free connection in the pool.
11
12
* By default, there's no limit on the number of connections. If you try to do a lot of things at once, you can create an arbitrary number of connections. This can cause the database to return an error such as "too many connections."
12
13
* In Go 1.1 or newer, you can use `db.SetMaxIdleConns(N)` to limit the number of *idle* connections in the pool. This doesn't limit the pool size, though.
0 commit comments