Skip to content

Commit 4416483

Browse files
committed
Add readme section about connection pool
1 parent 6ec775d commit 4416483

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

README.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ A MySQL-Driver for Go's [database/sql](https://golang.org/pkg/database/sql/) pac
1515
* [Address](#address)
1616
* [Parameters](#parameters)
1717
* [Examples](#examples)
18+
* [Connection pool and timeouts](#connection-pool-and-timeouts)
1819
* [LOAD DATA LOCAL INFILE support](#load-data-local-infile-support)
1920
* [time.Time support](#timetime-support)
2021
* [Unicode support](#unicode-support)
@@ -264,7 +265,7 @@ Type: duration
264265
Default: 0
265266
```
266267

267-
I/O read timeout. The value must be a decimal number with a unit suffix ( *"ms"*, *"s"*, *"m"*, *"h"* ), such as *"30s"*, *"0.5m"* or *"1m30s"*.
268+
I/O read timeout. The value must be a decimal number with a unit suffix (*"ms"*, *"s"*, *"m"*, *"h"*), such as *"30s"*, *"0.5m"* or *"1m30s"*.
268269

269270
##### `strict`
270271

@@ -287,7 +288,7 @@ Type: duration
287288
Default: OS default
288289
```
289290

290-
Timeout for establishing connections, aka dial timeout. The value must be a decimal number with a unit suffix ( *"ms"*, *"s"*, *"m"*, *"h"* ), such as *"30s"*, *"0.5m"* or *"1m30s"*. To configure the duration after which connections are removed from the connection pool, use [*sql.DB.SetConnMaxLifetime](https://golang.org/pkg/database/sql/#DB.SetConnMaxLifetime).
291+
Timeout for establishing connections, aka dial timeout. The value must be a decimal number with a unit suffix (*"ms"*, *"s"*, *"m"*, *"h"*), such as *"30s"*, *"0.5m"* or *"1m30s"*.
291292

292293
##### `tls`
293294

@@ -306,7 +307,7 @@ Type: duration
306307
Default: 0
307308
```
308309

309-
I/O write timeout. The value must be a decimal number with a unit suffix ( *"ms"*, *"s"*, *"m"*, *"h"* ), such as *"30s"*, *"0.5m"* or *"1m30s"*.
310+
I/O write timeout. The value must be a decimal number with a unit suffix (*"ms"*, *"s"*, *"m"*, *"h"*), such as *"30s"*, *"0.5m"* or *"1m30s"*.
310311

311312

312313
##### System Variables
@@ -380,6 +381,11 @@ No Database preselected:
380381
user:password@/
381382
```
382383

384+
385+
### Connection pool and timeouts
386+
The connection pool is managed by Go's database/sql package. For details on how to configure the size of the pool and how long connections stay in the pool see `*DB.SetMaxOpenConns`, `*DB.SetMaxIdleConns`, and `*DB.SetConnMaxLifetime` in the [database/sql documentation](https://golang.org/pkg/database/sql/). The read, write, and dial timeouts for each individual connection are configured with the DSN parameters [`readTimeout`](#readtimeout), [`writeTimeout`](#writetimeout), and [`timeout`](#timeout), respectively.
387+
388+
383389
### `LOAD DATA LOCAL INFILE` support
384390
For this feature you need direct access to the package. Therefore you must change the import path (no `_`):
385391
```go

0 commit comments

Comments
 (0)