-
Notifications
You must be signed in to change notification settings - Fork 822
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
Automatically prepare statements based on use #1237
Comments
FYI (unrelated) the idea of persisting prepared connections across close/open in pooled connections has been implemented in #483. It's a huge performance optimization and our conversation on the pgsql-hackers list is making me think that it should be on by default (it's currently opt-in). However, Npgsql doesn't have any sort of mechanism for automatically preparing statements, similar to what you do in pgjdbc. The approach up to now has been to leave this up to the user - if the user chooses to, they can definitely prepare, but Npgsql won't do it implicitly for them. I can definitely see the merit of automatic preparation, the only objection I have right now is a general aversion of implicit/magical mechanisms like this - in general I prefer APIs to be very simple and do exactly what they mean, with a minimum of under-the-hood logic. But I'll definitely think about this. |
good
Just in case, there are caveats:
Here's relevant pgjdbc fix: https://github.com/pgjdbc/pgjdbc/pull/451/files |
* aspnetcore: Remove dependency on net451 and mono * aspnetcore: Update PostgreSQL connection string for latest npgsql - Prepared statements are now persisted by default, so the PersistPrepared option has been removed. - npgsql/npgsql#1237 * aspnetcore: Make shell scripts executable * aspnetcore: Change scripts to use `dotnet Benchmarks.dll` - Scripts currently use `dotnet run` which is intended for iterative development rather than production. - Should not cause a measurable change in performance. * aspnetcore: Add DB scenarios to README.md * aspnetcore: Update framework and packages to 1.1 * aspnetcore: Remove unnecessary import from project.json * aspnetcore: Make dotnetcore.sh executable * aspnetcore: Update dotnetcore.sh to 1.1
* aspnetcore: Remove dependency on net451 and mono * aspnetcore: Update PostgreSQL connection string for latest npgsql - Prepared statements are now persisted by default, so the PersistPrepared option has been removed. - npgsql/npgsql#1237 * aspnetcore: Make shell scripts executable * aspnetcore: Change scripts to use `dotnet Benchmarks.dll` - Scripts currently use `dotnet run` which is intended for iterative development rather than production. - Should not cause a measurable change in performance. * aspnetcore: Add DB scenarios to README.md * aspnetcore: Update framework and packages to 1.1 * aspnetcore: Remove unnecessary import from project.json * aspnetcore: Make dotnetcore.sh executable * aspnetcore: Update dotnetcore.sh to 1.1
* aspnetcore: Remove dependency on net451 and mono * aspnetcore: Update PostgreSQL connection string for latest npgsql - Prepared statements are now persisted by default, so the PersistPrepared option has been removed. - npgsql/npgsql#1237 * aspnetcore: Make shell scripts executable * aspnetcore: Change scripts to use `dotnet Benchmarks.dll` - Scripts currently use `dotnet run` which is intended for iterative development rather than production. - Should not cause a measurable change in performance. * aspnetcore: Add DB scenarios to README.md * aspnetcore: Update framework and packages to 1.1 * aspnetcore: Remove unnecessary import from project.json * aspnetcore: Make dotnetcore.sh executable * aspnetcore: Update dotnetcore.sh to 1.1
Triggered by @vlsi's comment: #1227 (comment)
Basically, keep track of often-executed queries and implicitly prepare them once an execution threshold is reached. Manage these implicitly-prepared statements with an LRU cache to prevent explosion.
Think more about what exactly this means.
The text was updated successfully, but these errors were encountered: