Open tmm1 opened 2 weeks ago
maybe cache misses are inevitable here because these are meant to be distinct queries sent the to the server. but i wonder if there's a way to put the comment on just the EXECUTE part and not the PREPARE
Good question. I'm gonna pull this issue into the ongoing Tracing GA project and think about it.
By the way let me know if you run into any other issues related to tracing, this is super relevant right now, and we will tackle them asap. A good chunk of important bugfixes might hopefully make it into the next release, and more are coming soon.
the postgres driver uses prepared statements to prevent sql injection. a new statement is created per query, and then cached for subsequent queries. this works as expected.
however, when you enable tracing it adds sql comments to your statements:
https://github.com/prisma/prisma-engines/blob/edd552ca6fe6bb4ebbfe57bafc00a55aef8e10dd/query-engine/connectors/sql-query-connector/src/sql_trace.rs#L34-L37
wouldn't this mean the statement cache, which uses the raw sql text as the cache key, would no longer be effective?
https://github.com/prisma/prisma-engines/blob/edd552ca6fe6bb4ebbfe57bafc00a55aef8e10dd/quaint/src/connector/postgres/native/mod.rs#L322-L323
https://github.com/prisma/prisma-engines/blob/edd552ca6fe6bb4ebbfe57bafc00a55aef8e10dd/quaint/src/connector/postgres/native/mod.rs#L85-L86
cc @aqrln