如何修改MYSQL默认的排序方式

发布网友 发布时间:2022-04-23 17:01

我来回答

1个回答

热心网友 时间:2022-04-10 14:15

参考mysql官方的回答:
当你的表示myisam时:
SELECT * FROM tbl -- this will do a "table scan". If the table has never had any DELETEs/REPLACEs/UPDATEs, the records will happen to be in the insertion order, hence what you observed.
大致意思为,一个myisam引擎表在没有任何的删除,修改操作下,执行 select 不带order by,那么会按照插入顺序进行排序。

If you had done the same statement with an InnoDB table, they would have been delivered in PRIMARY KEY order, not INSERT order. Again, this is an artifact of the underlying implementation, not something to depend on.
对于innodb引擎表来说,在相同的情况下,select 不带order by,会根据主键来排序,从小到大

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com