Home > database >  Single table Mysql database query are getting slower and slower, a total of 300 w
Single table Mysql database query are getting slower and slower, a total of 300 w

Time:09-24

1. Has a unique index
2. The query to the total number of article, takes more than 2 min basic
Consult everybody elder bosses, guide the direction of the troubleshooting problems, looking for solutions,

CodePudding user response:

The reason may be that the index order, I changed the order of the two fields, query time obviously improve
The diagram below:
Caption
EXPLAIN this table is as follows:
! [images] (https://img-ask.csdn.net/upload/201901/04/1546573837_260164.png)
EXPLAIN this table is as follows:
! [images] (https://img-ask.csdn.net/upload/201901/04/1546573902_487584.png)! [images] (https://img-ask.csdn.net/upload/201901/04/1546573917_789094.png)! [images] (https://img-ask.csdn.net/upload/201901/04/1546573936_229062.png)
Query time is: 0.6 ~ 2 s +
By the query is slow, may be indexed, but I can't confirm and optimization,

CodePudding user response:

The reason may be that the index order, I changed the order of the two fields, query time obviously improve
The diagram below:
Caption
EXPLAIN this table is as follows:

Query time is: 0.6 ~ 2 s +
By the query is slow, may be indexed, but I can't confirm and optimization,

CodePudding user response:

Query large table to the total number of article don't do it,
Please refer to: https://blog.csdn.net/yenange/article/details/78973546

CodePudding user response:

Thank you, have a reference,

CodePudding user response:

You can also create a new table transfer of the data in the past, to build the related query index
There might be redundant index data,
  • Related