Table Valued Function Killing My Query Performance

后端 未结 5 1280
盖世英雄少女心
盖世英雄少女心 2020-12-04 19:54

I was having a horrible time today trying to get a query to perform the way I would expect. I had to make a slight change to a table valued function that lives in the query

5条回答
  •  囚心锁ツ
    2020-12-04 20:35

    Really impossible to answer definitively without more information. However, since I like to take crazy stabs in the dark . . .

    Table variables can't be optimized by the engine--the engine always "assumes" that the table variable only has one row in it when it generates an execution plan. That is one reason why you might be seeing strange performance.

提交回复
热议问题