The explain SELECT COUNT (*) AS think_count FROM ` traffic_vehicle_pass ` WHERE ` PASS_TIME ` BETWEEN '1613835713' AND '1616427713' AND ` CROSSING_ID ` IN (' 321 ', '322', '323', '324', '325', '326', '327', '328', '329', '330', '331', '332', '333', '334', '335', '336', '337', '338', '339', '340', '341', '342', '343', '344', '345', '346', '347', '348', '349', '350', '351', '352', '353', '354') \ G;
The same statement under mysql5.7 show
* * * * * * * * * * * * * * * * * * * * * * * * * * * 1 row * * * * * * * * * * * * * * * * * * * * * * * * * * *
Id: 1
Select_type: SIMPLE
Table: traffic_vehicle_pass
Partitions: NULL
Type: range
Possible_keys: INX_VEHICLE_CROSSID, INX_VEHICLE_PASSTIME
Key: INX_VEHICLE_PASSTIME
Key_len: 5
Ref: NULL
Rows: 3497
Filtered: 50.19
Extra: Using index condition; Using the where
1 row in the set, 1 warning (0.00 SEC)
Because of machine problems later in the database Server version: 10.4.17 - MariaDB checked the corresponding version of mysql 8.0
But the above statement execution occurs problems
* * * * * * * * * * * * * * * * * * * * * * * * * * * 1 row * * * * * * * * * * * * * * * * * * * * * * * * * * *
Id: 1
Select_type: SIMPLE
Table: traffic_vehicle_pass
Type: ALL
Possible_keys: INX_VEHICLE_CROSSID, INX_VEHICLE_PASSTIME
Key: NULL
Key_len: NULL
Ref: NULL
Rows: 45359005
Extra: Using the where
1 row in the set (0.114 SEC)
Cannot index, lead to scan the full table, excuse me this is where there is a problem, now can't return to the previous version, or where to set up, please give directions!
Execution time to 15 seconds, and 50 seconds, has been unable to use.
SQL statements will be IN bits, like the following would have a normal
The explain SELECT COUNT (*) AS think_count FROM ` traffic_vehicle_pass ` WHERE ` PASS_TIME ` BETWEEN '1613835713' AND '1616427713'.