Shared db connection pool in lambdas - do you ever close the connection explicitly?

This page summarizes the projects mentioned and recommended in the original post on

Our great sponsors
  • Scout APM - Less time debugging, more time building
  • SonarLint - Deliver Cleaner and Safer Code - Right in Your IDE of Choice!
  • SaaSHub - Software Alternatives and Reviews
  • pgx

    PostgreSQL driver and toolkit for Go

    Just doing some testing with Golang postgres library pgx's connection pools, and I figure I could set this up outside of the main() function to share the connection pool with concurrent lambda executions. One thing I can't figure out though is I don't think I can safely, and explicitly call a close() on the connection. Is this normal to just let the connection time out if the lambda is not being used? If the connection times out before the lambda shuts off, then how can I re-establish a globally available connection pool? I imagine this is a potential problem for any db that's not accessible over HTTP(s)?

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts