db icon indicating copy to clipboard operation
db copied to clipboard

pgx v5 support

Open elee1766 opened this issue 1 year ago • 5 comments

any plans to upgrade or make another postgres wrapper which supports pgx v5?

pgxv5 performance is a good amount better, because it has a lot more reuse of connection read buffers. this is actually something we ran into with upper using both the SQL and pgxv4 driver. we ended up resolving the problem through just rewriting the resource hungry query routines in pgxv5 in a separate connection. currently we are avoiding the use of upper/db in our app unless necessary because of this.

I actually did this upgrade a while ago, ran into and fixed some problems with timezones, but otherwise the tests passed and it worked with my app. this is before v5 was released as stable.

would be happy to give another go at pgxv5 adapter for upper now that pgx v5 isn't in alpha and PR if this is something you guys would accept.

upper is still the best solution we've found for batching the upload of different structs via their tags.

elee1766 avatar May 07 '24 20:05 elee1766

Hello @elee1766,

How did you solve the timezones problem? I ran into the same thing. Can you try out this branch and see how it performs in your case? https://github.com/upper/db/pull/715

Thanks,

xiam avatar Jun 23 '24 23:06 xiam

oh god this was a long time ago.

I'll look to see if I still have this code. IIRC it was that I had to set the time zone using pgx I believe?

also if you meant to link a branch, I think you just linked the issue. I assume you mean the referenced pr though - I'll try it.

elee1766 avatar Jun 23 '24 23:06 elee1766

@elee1766 Aah sorry, my bad; I meant this branch: https://github.com/upper/db/pull/715. Thanks!

xiam avatar Jun 23 '24 23:06 xiam

synthetically it does better, but i don't have actual profiles from real application running in prod. (the distribution of calls is different)

i will see if i can maybe mirror some traffic, but no promises here

elee1766 avatar Jun 24 '24 00:06 elee1766

Hi @xiam

Wondering if this issue should be considered closed? I see support was added in 4.0.9? I've been using the pgx/v5 driver with upper/db for a while. I just pass the postgresql adaptor a *sql.DB as is required. Golang database/sql package works fine the pgx driver, so easy to do.

If this issue can be closed, then https://github.com/upper/db/issues/621 could probably also be closed.

Finally have to say, great work!! Really enjoy using upper/db.

fouched avatar Apr 19 '25 12:04 fouched