mysql5.6.19 Why can't I use the index _mysql

Source: Internet
Author: User

Table structure is simple

CREATE TABLE ' oplogs ' (
' id ' int (a) unsigned NOT null auto_increment,
' kind ' varchar (=) NOT null DEFAULT ', 
  
    ' op ' varchar NOT NULL,
' user ' varchar ' is not null default ',
' IP ' varchar ' is not null default ',
' up DateTime ' timestamp not NULL DEFAULT current_timestamp on UPDATE current_timestamp,
PRIMARY KEY (' id ')
engine=m Yisam auto_increment=34896 DEFAULT Charset=utf8 row_format=fixed
  

The result is 34,895

The SQL query statement is:

Select A.id,a.kind,a.op,a.user,a.ip,a.updatetime from Oplogs as a INNER join (select ID to oplogs where 1 order by ID des C limit 0,20) as B using (ID)

In the case of 5.6.19

Read content in PHP and display

3.5 seconds to show results first

But the same configuration

Under Linux under 5.5.38

It only takes about 0.7 seconds.

It's a strange situation.

The explain results were then executed under 5.6, as follows:

And the same data explain structure is as follows:

Comparison results are obviously mainly in the sort of oplogs, rows changed too much, a complete traversal, the first use of the index, resulting in the gap is too large, but the reason has not been found, who knows?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.