Does the number of columns returned affect the speed of a query?

前端 未结 18 2108
既然无缘
既然无缘 2020-12-10 16:27

If I have two queries

SELECT Id, Forename, Surname
FROM Person
WHERE PersonName Like(‘%frank%’)

And

SELECT *
FROM Person
WH         


        
18条回答
  •  不知归路
    2020-12-10 16:47

    Regardless of performance issues, it is good practice to always enumerate all fields in your queries.

    • What if you decide to add a TEXT or BLOB column in the future that is used for a particular query? Your SELECT * will return the additional data whether you need it or not.
    • What if you rename a column? Your SELECT * will always work, but the relying code will be broken.

提交回复
热议问题