Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Make use of prepared commands #5459
ADO.NET allows users to prepare commands, which allows databases to cache query plans and parses. IIRC in modern version of SqlServer this doesn't have much effect (any?), but in other providers this is an important feature - repeated complicated queries in PostgreSQL definitely benefit from prepared commands.
I know there's already an SQL caching mechanism inside EFCore, and although I'm sure it would be non-trivial to cache commands as well it would be a great feature.
Definitely a lower-priority backlog feature request.
Note that for the next release of Npgsql (3.2), I plan to introduce an automatic/implicit preparation mechanism at the driver level - any statement used more than X times would be automatically prepared up to a certain quota, etc. This should increase performance with EFCore in a very significant way, without any change on your end.
However, it seems like EFCore may have more knowledge as to which statements to prepare - in any case it seems better-placed to make such decisions than the ADO.NET driver. So I think this feature is still relevant at the EFCore level.