The slow_query view uses the date field as a where condition, where the position of time is different (but equivalent), and the dates in the execution plan are different
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
use information_schema;
mysql> explain select count(*) from slow_query where '2024-11-20 12:41:45' < time ;
+----------------------+----------+------+------------------+----------------------------------------------------------------------------+
| id | estRows | task | access object | operator info |
+----------------------+----------+------+------------------+----------------------------------------------------------------------------+
| HashAgg_6 | 1.00 | root | | funcs:count(1)->Column#80 |
| └─MemTableScan_8 | 10000.00 | root | table:SLOW_QUERY | start_time:2024-11-19 12:41:44.999000, end_time:2024-11-20 12:41:44.999000 |
+----------------------+----------+------+------------------+----------------------------------------------------------------------------+
2 rows in set (0.00 sec)
mysql> explain select count(*) from slow_query where time > '2024-11-20 12:41:45' ;
+----------------------+----------+------+------------------+----------------------------------------------------------------------------+
| id | estRows | task | access object | operator info |
+----------------------+----------+------+------------------+----------------------------------------------------------------------------+
| HashAgg_6 | 1.00 | root | | funcs:count(1)->Column#80 |
| └─MemTableScan_8 | 10000.00 | root | table:SLOW_QUERY | start_time:2024-11-20 12:41:45.001000, end_time:2024-11-21 12:41:45.001000 |
+----------------------+----------+------+------------------+----------------------------------------------------------------------------+
2 rows in set (0.00 sec)
### 2. What did you expect to see? (Required)
the dates in the execution plan are same.
### 3. What did you see instead (Required)
The slow_query view uses the date field as a where condition, where the position of time is different (but equivalent), and the dates in the execution plan are different
### 4. What is your TiDB version? (Required)
mysql> select version();
+--------------------+
| version() |
+--------------------+
| 8.0.11-TiDB-v7.5.2 |
+--------------------+
1 row in set (0.00 sec)
Contributor guide
Assessment
This issue has not been assessed yet.