Description:
excute query statements:
select *from t1 where task_statu=0 order by create_time
result: There is no suitable result , no rows return
use profiling find “Creating sort index”
i think this a bug;
when no data have ,profiling no have "Creating sort index"
How to repeat:
mysql>CREATE TABLE `t1` (
`id` int(11) primary key,
`task_statu` int(11) DEFAULT NULL,
`create_time` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
mysql>INSERT INTO T1(id,task_statu,create_time) values(1,2,now()),(2,3,now()),(3,4,now());
mysql> set global profiling = 1;
mysql> show profiles;
mysql> select *from t1 where task_statu=0 order by create_time;
Empty set (0.00 sec)
mysql> show profile for query 21;
+----------------------+----------+
| Status | Duration |
+----------------------+----------+
| starting | 0.000093 |
| checking permissions | 0.000007 |
| Opening tables | 0.000019 |
| init | 0.000052 |
| System lock | 0.000013 |
| optimizing | 0.000012 |
| statistics | 0.000020 |
| preparing | 0.000012 |
| Sorting result | 0.000005 |
| executing | 0.000002 |
| Sending data | 0.000008 |
| Creating sort index | 0.000053 |
| end | 0.000003 |
| query end | 0.000008 |
| closing tables | 0.000009 |
| freeing items | 0.000021 |
| cleaning up | 0.000012 |
+----------------------+----------+
17 rows in set, 1 warning (0.00 sec)
Suggested fix:
sql\filresort.cc first step add some of things
if don't have data ,not excuter process