Skip to content

How to set database/sql pool configuration when using stdlib.OpenDBFromPool(pool) #2222

Answered by lzakharov
aeneasr asked this question in Q&A
Discussion options

You must be logged in to vote

When using stdlib.OpenDBFromPool, the *sql.DB only works as an adapter for pgxpool.Pool. So you should configure all parameters for pgxpool.Pool via pgxpool.Config. The same for the stats - connections live only in pgxpool.Pool, so you have to use it’s stats.

Also you can omit db.SetMaxOpenConns(0), cause it automatically configured on stdlib.OpenDBFromPool.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@aeneasr
Comment options

Answer selected by aeneasr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants