Closed MichalSznajder closed 3 years ago
With queries in memory the database "prepares" them every time you run, Stored procedures as you know are stored. The difference is not that significant for isolated queries but it is relevant on high database throughput
Why not use prepared statements then? Npsql offers them as described at https://www.npgsql.org/doc/prepare.html.
I had a look at SQL Server variant of IDistributedCache at according to https://github.com/dotnet/aspnetcore/blob/main/src/Caching/SqlServer/src/SqlQueries.cs they just use raw SQL queries.
Why not use stored procedures?
To simplify deployment. With CreateInfrastructure
we already have table in database but still some script must be run to install stored procedures to query it.
To simplify deployment.
I do not agree, from user's perspective is the same step: CreateInfrastructure
.
With Sql Server you also have the similar step:
dotnet sql-cache create "your_database_connection_string" dbo
So, in fact it goes both ways, I just can't see a meaningful use case to justify one over another rather than preference...
I missed that CreateInfrastructure creates those stored proc in DB. Sorry for hassle.
It is a question than issue.
Do you have any idea why stored procs are required instead of just creating queries in memory and preparing them?