-
I have a project with dependencies where some require sql.DB and others require pgxpool. Currently I instantiate both like this:
From here I pass both Based on this discussion it appears that it's okay to to have one pgxpool and one sql.DB instantiated, but I'm not sure about performance. Prior to the new implementation, having a sql.DB created came with a performance cost and other issues, as described here. Is this still the case today? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
No. The sql.DB gets connections as needed from the pgxpool and immediately releases them back to the pgxpool.
It should be fine to use the pgxpool.Pool and the sql.DB created from that pool at the same time. I'm not aware of any performance issues. |
Beta Was this translation helpful? Give feedback.
No. The sql.DB gets connections as needed from the pgxpool and immediately releases them back to the pgxpool.
It should be fine to use the pgxpool.Pool and the sql.DB created from that pool at the same time. I'm not aware of any performance issues.