Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question: is it bad idea to keep connection open? #106

Open
eastwing27 opened this issue Mar 12, 2022 · 2 comments
Open

question: is it bad idea to keep connection open? #106

eastwing27 opened this issue Mar 12, 2022 · 2 comments

Comments

@eastwing27
Copy link

ATM our DB has restricted mount of connections (20) but is going to be used intense by many users. |> Sql.connect seems to create new connection each time it;s used so we're risking to reach the limit at the moment we release the feature. Alternatively, we can open a connection by let connection = new NpgsqlConnection(getConnectionString) and keep it open, but is it a good idea? What will happen if users use the same connection?

@aaronmu
Copy link
Contributor

aaronmu commented Mar 13, 2022

No need to worry. Npgsql uses connection pools under the hood. It's enabled by default. https://www.npgsql.org/doc/connection-string-parameters.html#pooling

@eastwing27
Copy link
Author

eastwing27 commented Mar 13, 2022

No need to worry. Npgsql uses connection pools under the hood. It's enabled by default. https://www.npgsql.org/doc/connection-string-parameters.html#pooling

So, if there's a restriction on DB end we should set maximum pool size, is that correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants