MySQL Forums
Forum List  »  Chinese

mysql8.0.16 Slow query
Posted by: 东山 邢
Date: August 03, 2021 10:44PM

Querying both conditions is very slow.But two criteria alone are fast.
mysql> select count(1) from meteorological_data where create_time between '2021-07-28 00:00:00' and '2021-08-04 00:00:00' ;
+----------+
| count(1) |
+----------+
| 101627 |
+----------+
1 row in set (0.07 sec)

mysql> select count(1) from meteorological_data where equipment_no = 1000000195;
+----------+
| count(1) |
+----------+
| 45817 |
+----------+
1 row in set (0.08 sec)

mysql> select count(1) from meteorological_data where equipment_no = 1000000195 and create_time between '2021-07-28 00:00:00' and '2021-08-04 00:00:00';
+----------+
| count(1) |
+----------+
| 14 |
+----------+
1 row in set (19.71 sec)


What causes the pattern to be narrow?

Options: ReplyQuote


Subject
Views
Written By
Posted
mysql8.0.16 Slow query
98
August 03, 2021 10:44PM
39
August 04, 2021 02:02AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.