Please i have a question

I'm building an API with expressJs

Do i need to create a single database connection for all my query

Or should i rather open and close a connection for every query.

Which one is more efficient?

I'm currently using the first approach but the heroku clearDB addons is keep crashing Everytime saying connexion closed!

Please help

  • 2
    I think you’re confusing devRant with Stack Overflow
  • 2
    @webapp Well they did post it with the “question” tag. So what are you complaining about?
    Sounds like what they did was confuse devRant with a place to find helpful people.
    The app specifically offers a question filter. So logic would dictate that if you think devRant isnt for that, you could simply mute that category.
    Have I missed anything?
  • 0
    For scale, open connection - query - close connection, the connection it's self will be minuscule to the load time.

    For small scale, open connection, query till the cows come home, let it close its self with idle -> not the "best way"
  • 2
    @LLAMS helpful people + devRant?
    do you know something I don't around here 🤔

    @webapp 🤷‍♂️ if it was a brand new green dot asking, then no SO they can go. But it's not and I'm enjoying the high of my morning coffee 🥰
  • 0
  • 0
    Do whichever and then wait for it to get caught by QA or fail in production because who gives a fuck.

    (Close it every time)
  • 0
    @HiFiWiFiSciFi please what is a QA?
  • 0
    @Afrographics https://npmjs.com/package/...

    I'm just kidding, it means "Quality Assurance".

    Or was I?
Add Comment