Comments (4)
database/sql keeps an idle pool. If there is no connection when a request is made, it creates a new one. If the pool is full when the connection is free, it throws it away.
On May 25, 2012, at 12:38 PM, Constantin [email protected] wrote:
I want to use pq in a middleware program that will serve more than 100 web clients simultaneously and it's possible to need a pool of 10 or 20 active connections to a PostgreSQL database and pool the connections between goroutines serving different web rest-services.
Is there an example how to do that using your pq driver?
In the golang docs there is something written about "database/sql" package:
"If the underlying database driver has the concept of a connection and per-connection session state, the sql package manages creating and freeing connections automatically, including maintaining a free pool of idle connections. "Best regards,
Constantin Teodorescu
Reply to this email directly or view it on GitHub:
https://github.com/bmizerany/pq/issues/21
from pq.
It sounds great but ... are there any fine tunings for pool size like "minimum of opened connections", "maximum of opened connections", "timeout for closing an unused connection" ? I searched for more detail but the golang package doc isn't too clear regarding that.
Thank you a lot for your quick answer,
Teo
from pq.
It's currently hard coded at two. I haven't needed to tune it myself.
If you have more questions regarding database/sql, I recommend asking then on the gonuts mailing list where it's authors can help you more. Pq specific questions can be made here.
On May 25, 2012, at 1:02 PM, Constantin [email protected] wrote:
It sounds great but ... are there any fine tunings for pool size like "minimum of opened connections", "maximum of opened connections", "timeout for closing an unused connection" ? I searched for more detail but the golang package doc isn't too clear regarding that.
Thank you a lot for your quick answer,
Teo
Reply to this email directly or view it on GitHub:
https://github.com/bmizerany/pq/issues/21#issuecomment-5939083
from pq.
OK, I'll ask there and dig a little into the database/sql code to find out!
Thank you again for your time,
Best regards,
Teo
P.S. I'll close the issue!
from pq.
Related Issues (20)
- Tx.Rollback returns ErrBadConn after context is cancelled
- Connection string parsing fails randomly HOT 2
- 1 Listener for 2 channel HOT 1
- SonarCloud Vulnerability: Make sure this PostgreSQL database password gets changed and removed from the code.
- Usage of COPY TO STDOUT WITH CSV
- RFC 9266: Channel Bindings for TLS 1.3 support
- Query extra_float_digits problem
- Is Postgres15.4 is compatible with the lib/pq package?
- What kind of mistake is this?
- how to deal with "cached plan must not change result type" error?
- Looking for a security contact to disclose a vulnerability HOT 1
- Exectuing pq.CopyIn fails with one of two errors depending on usage
- Why do I have errors in local language?
- pq: invalid array literal.
- pq: invalid input syntax for type integer HOT 2
- Private keys cause Trivy HIGH vulnerability alerts HOT 4
- Nil byte array doesn't get saved as JSONB field
- nil byte array `[]byte(nil)` is encoded as empty byte array `[]byte([])` instead of nil
- Extra DNS name verification is made in `verify-ca` mode, making it effectively `verify-full` HOT 1
- Got error pq: syntax error at the end of ... when doing custom dialer
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pq.