jet / equinox

.NET event sourcing library with CosmosDB, DynamoDB, EventStoreDB, message-db, SqlStreamStore and integration test backends. Focused at stream level; see https://github.com/jet/propulsion for cross-stream projections/subscriptions/reactions
https://github.com/jet/dotnet-templates
Apache License 2.0
472 stars 68 forks source link

perf: use a literal for queries, and stop doing silly stuff with correlation/causation ids #394

Closed nordfjord closed 1 year ago

nordfjord commented 1 year ago

Noticed during my memory leak investigation in propulsion that using @Variable style Commands in Npgsql leads to StringBuilder allocations and all sorts of fun processing in the application that is avoidable by using $1, $2 etc (the native format that pg parameterised queries take).

Secondly while scanning the code the queries looked a bit off with the CorrelationId and CausationId being picked from the json metadata. This makes sense if and only if we also place the id's onto these fields during writes. Since we don't this is just waste so 🧹 it

bartelink commented 1 year ago

All very neat, thanks!