Performance of COUNT SQL function

后端 未结 3 1082
情话喂你
情话喂你 2020-12-09 11:09

I have two choices when writing an SQL statement with the COUNT function.

  1. SELECT COUNT(*) FROM
  2. SELE
3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-09 11:45

    Performance should not matter because they do 2 different aggregates

    • COUNT(*) is all rows, including NULLs
    • COUNT(some_column_name), excludes NULL in "some_column_name"

    See the "Count(*) vs Count(1)" question for more

提交回复
热议问题