Home > database >  Mysql query slow problem (very challenging)
Mysql query slow problem (very challenging)

Time:10-06

About a 100 w lines of data table, the storage engine is MyIsam


In the slow logs 2017.8.8 day began to appear this kind of slow query log

Perform the following statement
 
Select d_id, does, url_1, title, sp_f68, creator, createdate, createtime, audited, sp_f3577, key_word, menddate, mendtime, mender, video_column, published_1 from content where creator='wangsh' and createdate & gt;='2017-08-08' order by d_id desc limit 0, 30;


The actual hit 5 records,

The phenomenon of
1. Do not add back every time limit to perform fast
2. Add limit0, 30 execution time 13 seconds
3. Add limit0, 100 soon

The explain




Strives for the solution

CodePudding user response:

With the explain see execution, analyze,

CodePudding user response:

@ sinat_28984567

Explain the screenshots have ah

CodePudding user response:

refer to the second floor response: I am your subject
@ sinat_28984567

The explain of screenshots have
three statements?

CodePudding user response:

Is different, I'm just in this condition in time data query time change, why can have different execution plan??

CodePudding user response:

Show the index from the content

CodePudding user response:

Filesort arising out of the sort order by d_id into order by createdate try, will soon have to
Or change the index createdate to d_id, createdate

CodePudding user response:

http://www.cnblogs.com/drcoding/p/4942277.html
  • Related