Performance between sql.DB and pgxpool
I noticed that pgxpool is also a DB pool, but its documentation only says, "Package pgxpool is a concurrency-safe connection pool for pgx."
Which one would have better performance theoretically? (Haven't done any benchmark yet)
Using pgx directly should have better performance than using database/sql. The pgx database/sql driver is implemented on top of the native pgx interface so in theory it should always be faster.
That said, whether the performance difference is significant or not depends to a great deal on network latency, PG server query times, and the data types of the query results.
In most cases, you should choose based on which features you need rather than performance. For example, most ORMs only work with database/sql, but many PostgreSQL specific features such as LISTEN/NOTIFY and the COPY protocol can only be accessed through the pgx native interface.