prisma / prisma-engines

🚂 Engine components of Prisma ORM
https://www.prisma.io/docs/concepts/components/prisma-engines
Apache License 2.0
1.2k stars 240 forks source link

upgrade rust-postgres and support single-packet queries? #5025

Open tmm1 opened 1 month ago

tmm1 commented 1 month ago

the tokio-postgres dep is currently pinned to a 0.7.7 fork: https://github.com/prisma/rust-postgres/commits/pgbouncer-mode/

the latest version is 0.7.11: https://github.com/sfackler/rust-postgres/blob/master/tokio-postgres/CHANGELOG.md

the newer versions include a query_typed which reduces the number of network packet roundtrips for a fresh query from 3 to 1: https://github.com/sfackler/rust-postgres/pull/1147

cc @aqrln cc #5017

tmm1 commented 1 month ago

cc @janpio https://github.com/sfackler/rust-postgres/pull/1067#issuecomment-1751500297

We at @prisma would also be very interested in this. Right now, we do a weird dance of wrapping all queries in transactions, and each time deallocating the named prepared statements when talking to a PgBouncer instance in transaction mode - which adds up to 3 additional roundtrips for 1 query and has an obvious very bad effect on our performance.

aqrln commented 1 month ago

Oh, I just realized this also solves the problem of the traceparent comment invalidating prepared statement cache with tracing enabled, wonderful.