Performance improvements for beam-postgres#797
Conversation
|
The baseline is: This is showing a 50% slowdown in beam-postgres vs postgresql-simple |
|
After removing some redundant work from parsing every row:
|
|
I believe that the remaining slowdown is due to the use of free monads. This means that speeding up the Thankfully, this shouldn't be too bad, as there is only one "third-party" backend released on Hackage ( In any case, this will be left for further work |
a12c2f5 to
4f05df1
Compare
ecb0be6 to
c257da7
Compare
4f05df1 to
3509a6c
Compare
3509a6c to
d82f007
Compare
|
I am perplexed. The benchmarks on my local machine are showing that this PR closes the gap between |
renderExecReturningList called cachedGetFields but then freed the result via unsafeFreeResult, allowing libpq to reuse the pointer address on the next Pg.exec. A subsequent query with different column types would get a false cache hit and inherit stale field OID metadata, causing a BeamRowReadError on column 0. Fix: renderExecReturningList calls getFields directly. The cache remains for stepProcess (CursorBatching), where it is safe and beneficial. Regression test added to beam-postgres-tests. Fixes #802, regression introduced in #797. Co-authored-by: Christian Berg <christian.berg@kraftwerk.io> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This PR is about improving performance of beam-postgres to match postgresql-simple.
Fixes #769