Home > database >  An SQL statement added index more slowly
An SQL statement added index more slowly

Time:10-07

 
SELECT COUNT (*) AS the COUNT FROM (SELECT ` uid ` FROM ` finreport ` WHERE ` checkday ` BETWEEN '2013-1-24' AND '2017-07-27 s' GROUP BY uid) t LIMIT 1


Less than 50 w data, with no index 0.3 seconds; On the uid indexed to 8 to 9 seconds instead, what reason is this?
If the uid and checkday combined index effect is reflected on the
With the explain analysis found that only add the uid index and add the uid, checkday joint index key_len is the only difference between a 4 a is 7, the query on the number of rows is exactly the same

CodePudding user response:

With text posted ( don't map!
) the explain the select...
And
show index from

For analysis

CodePudding user response:

On the uid and the index itself does not improve your statement query speed, because of who you are, according to checkday to retrieve data, so the only need to add a checkday field index is ok,

CodePudding user response:

Same as above! Upstairs is my brother!

CodePudding user response:

Only need checkday index
  • Related