Why does sp_executesql run slower when parameters are passed as arguments

后端 未结 3 1787

Query 1: (lightning fast)

sp_executesql \"select * from tablesView where Id = 1\"

vs.

Query 2: (too slow)

sp_executesql         


        
3条回答
  •  忘掉有多难
    2021-02-20 11:33

    1. Avoid using SELECT *
    2. ADO.NET 3.5 there is "parameter quessing" in Linq 1=TINYINT 2345=SMALLINT 76357242=INT .. in ADO.NET 4.0 parameter quessing is replaced with default INT data type 1=INT, 2335=INT ,76357242=INT)

提交回复
热议问题