When using stdlib.OpenDBFromPool
, should the database be closed in the same function?
#2091
Unanswered
meesvandongen
asked this question in
Q&A
Replies: 1 comment
-
Typically, your process will have a single However, it may be better for your PostgreSQL server to disconnect via the PostgreSQL protocol rather than relying on whatever the OS does to TCP connections when the process ends. As far as the test goes, we do want to clean up before the end of the process as there may be many other tests to run and we don't want those connection slots on the server to be consumed. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The test (639691c) within the
pgx
package does suggest that it should be closed.The standard package says the following
So I am not sure if it is valid to not close the db; and if it is, what the performance implications are.
Beta Was this translation helpful? Give feedback.
All reactions