-
Notifications
You must be signed in to change notification settings - Fork 817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NpgsqlBatch does not properly set ConnectorPreparedOn property on its BatchCommands #5458
Comments
Hello. I'm not sure whether your first test is correct (since you never execute the batch none of the queries are going to be auto prepared, so |
Hello @vonzshik! Regarding my first test, it seems that you are right. After I changed it to this:
the test stopped failing. Frankly, we don't use the auto prepare, so I reported that one because I thought there is similar issue as with the explicit prepare. I also looked a bit into the code, but it seems that I didn't get it completely right. Anyway. you can consider adding this test if you find it useful. Thanks! |
Fixes npgsql#5458 (cherry picked from commit 9e3a8df) Signed-off-by: monjowe <jonas.westman@monitor.se>
Fixes npgsql#5458 (cherry picked from commit 9e3a8df) Signed-off-by: monjowe <jonas.westman@monitor.se>
Steps to reproduce
Add following two tests to https://github.com/npgsql/npgsql/blob/main/test/Npgsql.Tests/PrepareTests.cs file and run them.
The issue
After bumping Npgsql version from 7.0.1 to 7.0.4 we experienced a serious performance degradation in our performance benchmarks. We did an investigation, and the exact culprit seems to be this fix: #4821
It seems that preparation (for a given batch with batch commands) is unnecessary reset because of
ConnectorPreparedOn
property being incorrectly (almost) always null.Further technical details
Please note that the issue is still there for the latest versions of npgsql and PostgresSql. Versions used for the tests from above:
Npgsql version: latest from main (8.0.0)
PostgreSQL version: 15.4
Operating system: Windows 10
The text was updated successfully, but these errors were encountered: