SQL performance MAX()

前端 未结 4 2038
遇见更好的自我
遇见更好的自我 2020-12-11 02:13

Just got a small question. When trying to get a single max-Value of a table. Which one is better?

SELECT MAX(id) FROM myTable WHERE (whatever)
4条回答
  •  盖世英雄少女心
    2020-12-11 02:24

    All query optimizers worth their salt should produce query plans with identical performance for both queries: if there is an index on the column being optimized, both queries should use it; if there is no index, both would produce a full table scan.

提交回复
热议问题