You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
why is the performance using DynamicParameters in the SQL IN clause more than 3 times slower than actually using a composed sql query?
may i ask which parts can optimize the performance of parameters, or declare the type of parameters?
Ex : select * from table where column IN :test.
var list = new List(){"1","2"}
var parameters = new DynamicParameters();
parameters.Add(":test",list);
var table_datas = connection.Query(sql, parameters);
The text was updated successfully, but these errors were encountered:
Well, to start with: there's no need to use DynamicParameters here - just:
varparameters=new{ test = list };
should be fine; however, internally, Dapper needs to recognize what your intent is and rewrite this as a multi-parameter query, i.e.
select*from table where column IN (:test0, :test1)
(or something similar). I'd need to put together an intentional benchmark to comment on any specific scenario, but you're also trading your own time in this mix, and security, and a bunch of other things. Note that on some platforms we might also use alternative mechanisms like string_split which does not require us to do quite as much rewriting work (although still some).
why is the performance using DynamicParameters in the SQL IN clause more than 3 times slower than actually using a composed sql query?
may i ask which parts can optimize the performance of parameters, or declare the type of parameters?
Ex : select * from table where column IN :test.
var list = new List(){"1","2"}
var parameters = new DynamicParameters();
parameters.Add(":test",list);
var table_datas = connection.Query(sql, parameters);
The text was updated successfully, but these errors were encountered: