EF 4.1: Why does turning a constant into a variable result in extra sub query?

后端 未结 4 1107
失恋的感觉
失恋的感觉 2021-01-06 09:51

Today I discovered that Entity Framework was adding an unnecessary sub query to the SQL it generates. I started digging my code trying to narrow down where it might come fro

4条回答
  •  梦毁少年i
    2021-01-06 10:14

    Is this actually a big difference in the SQL? The inner query is the same as the original query, and the outer query is just a wrapper over the inner that doesn't change the result set.

    Unless this is causing problems, I personally wouldn't worry about it. Do the query plans differ between the two flavours of query? My guess is that they're identical.

提交回复
热议问题