Linq to SQL: select optimization

后端 未结 6 1006
梦如初夏
梦如初夏 2021-01-18 11:16

On large tables in MSSQL; selecting specific columns results in greater speed of the query. Does the same apply to Linq to SQL?

Would this:

var perso         


        
6条回答
  •  无人及你
    2021-01-18 12:11

    If you are limiting the size of the result set by only selecting a few specific columns, then YES it will have an affect.

    EDIT ading clarification from comment

    How is this better, it will reduce the size of the resultant data returned from SQL AND it will reduce the size of the objects used to store the results in memory.

    This is due to the fact that in the end LINQ to SQL generates SQL, so the same performance benefits exist.

提交回复
热议问题