Home > Database > Mysql Tutorial > mysql order by null

mysql order by null

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 16:38:47
Original
1860 people have browsed it

order by null用途是强制对查询结果禁用排序。通过explain检查查询语句时候,如果看到Extra列中有Using filesort,这是对性能有一定影响的,特别是使用了group by时,就算你没有显示的指定order by,mysql会默认按照分组字段进行排序。某些情况下是没有必要

order by null用途是强制对查询结果禁用排序。通过explain检查查询语句时候,如果看到Extra列中有Using filesort,这是对性能有一定影响的,特别是使用了group by时,就算你没有显示的指定order by,mysql会默认按照分组字段进行排序。某些情况下是没有必要使用排序的,例如在处理表报数据的时候(把原始表数据统计后插入到一个用于报表查询的表),则完全可以可以使用order by null来取消排序。如:

insert into reportTable(day, clicks, revenue)
    select day, count(*), sum(revenue) from clickOriginTalbe
    group by day
    order by null
Copy after login
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template