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

前端 未结 18 2107
既然无缘
既然无缘 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-10 16:47

    the only time i use "select *" is not event really a "select *"

    specifically:

    select count(*) from table

    is not that same as

    select count(ID) from table

    the first returns the number of rows in the table
    but the second returns the number of rows with a NOT NULL ID value.

    a subtle distinction but worth remembering.

提交回复
热议问题