ORDER BY NULL in MySQL

后端 未结 5 565
独厮守ぢ
独厮守ぢ 2020-12-23 17:09

What is ORDER BY NULL in MySQL?

Does it decrease the query speed?

5条回答
  •  春和景丽
    2020-12-23 17:30

    Since Mysql 8.0 ORDER BY NULL doesn't improve query performance.

    https://dev.mysql.com/doc/refman/8.0/en/order-by-optimization.html

    Previously (MySQL 5.7 and lower), GROUP BY sorted implicitly under certain conditions. In MySQL 8.0, that no longer occurs, so specifying ORDER BY NULL at the end to suppress implicit sorting (as was done previously) is no longer necessary. However, query results may differ from previous MySQL versions. To produce a given sort order, provide an ORDER BY clause.

提交回复
热议问题