Coder Social home page Coder Social logo

Comments (4)

bmizerany avatar bmizerany commented on June 3, 2024

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.

brailateo avatar brailateo commented on June 3, 2024

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.

bmizerany avatar bmizerany commented on June 3, 2024

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.

brailateo avatar brailateo commented on June 3, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.