Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.3.9
-
None
Description
explain select `payment_uid`,`date`,`simulation_state`
|
from `stock`
|
where `date` >= '2017-05-31 22:00:00' and `date` <= '2018-05-31 22:00:00' order by date desc;
|
+------+-------------+-------+------+---------------+------+---------+------+-----------+-----------------------------+
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
|
+------+-------------+-------+------+---------------+------+---------+------+-----------+-----------------------------+
|
| 1 | SIMPLE | stock | ALL | date | NULL | NULL | NULL | 233416309 | Using where; Using filesort |
|
+------+-------------+-------+------+---------------+------+---------+------+-----------+-----------------------------+
|
1 row in set (0.01 sec)
|
explain select `payment_uid`,`date`,`simulation_state`
|
from `stock`
|
where `date` >= '2017-05-31 22:00:00' and `date` <= '2018-05-31 22:00:00' order by date ;
|
+------+-------------+-------+------+---------------+------+---------+------+-----------+-----------------------------+
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
|
+------+-------------+-------+------+---------------+------+---------+------+-----------+-----------------------------+
|
| 1 | SIMPLE | stock | ALL | date | NULL | NULL | NULL | 233416309 | Using where; Using filesort |
|
+------+-------------+-------+------+---------------+------+---------+------+-----------+-----------------------------+
|
1 row in set (0.00 sec)
|
explain select `payment_uid`,`date`,`simulation_state`
|
from `stock`
|
where `date` >= '2017-05-31 22:00:00' and `date` <= '2018-05-31 22:00:00';
|
+------+-------------+-------+------+---------------+------+---------+------+-----------+-------------+
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
|
+------+-------------+-------+------+---------------+------+---------+------+-----------+-------------+
|
| 1 | SIMPLE | stock | ALL | date | NULL | NULL | NULL | 233416309 | Using where |
|
+------+-------------+-------+------+---------------+------+---------+------+-----------+-------------+
|
1 row in set (0.00 sec)
|
DDL is
`date` datetime DEFAULT NULL,
KEY `date` (`date`),
Important step to reproduce ,
We copy a 10.1.24 datadir and used mysql_upgrade -s
The filtered range is 120M rows
(psergey edited a bit to improve readability)
Attachments
Issue Links
- relates to
-
MDEV-17436 Add new meta system configuration variables
-
- Open
-
-
MDEV-4932 query with order by on indexed column is using filesort
-
- Closed
-
Hi Julien, Ivan,
Could you re run analyze query with bigger sort buffer like 512M or 1G and tell us what the current value of the sort_buffer_size ?
It does not change the fact that on SSD or NVMe sorting to read in the correct pk order the majority of record is less an issue to compare to spinning disk
But it can help quantify the cost of a reasonable sorting .