Mysql-help: primary key UPDATE is slow

Source: Internet
Author: User
Tags mysql update
I have encountered a problem recently. I cannot find the cause. please help me. thank you! A large number of such records have been found in mysql slow query logs recently & quot; # Time: 15062519: 02: 36 # User @ Host: admin [admin] @ [10.8.10.6] # Query_time: 4.962537Lock _ time: 0.20.50rows _ sent: 0Rows_examined: 1SETtimestamp1435230156; UPDATE 'Player... mysql update slowly queries the primary key

I have encountered a problem recently. I cannot find the cause. please help me. thank you!

A large number of such records have been found in mysql slow query logs recently.

# Time: 150625 19:02:36# User@Host: admin[admin] @  [10.8.10.6]# Query_time: 4.962537  Lock_time: 0.000050 Rows_sent: 0  Rows_examined: 1SET timestamp=1435230156;UPDATE `player` SET `last_login_time`=1435230010, `last_login_ip`='110.159.152.214', `last_login_line`=1, `online_flag`=1 WHERE id=124;
  1. Id is the primary key, InnoDB, and the table length is 4000 rows
  2. Lock_time, Rows_sent, and Rows_examined are not high, but Query_time is very high, and some of them exceed 10 seconds,
  3. On the contrary, if no index is added, Query_time is required to traverse the entire table for only 0.03 seconds.
  4. Persistent connections are used, and the total number of connections is 10-20.
  5. Traffic: about 10 M/hour for receiving and about 90 M/hour for sending
  6. Average mysql requests per second: 17
  7. Mysql versions 5.1.17 and 5.5.44 both have the same results.
  8. The server is configured with 8-core 16 GB, CentOS 6.5. cpu, memory, and io usage are not high, all of which are below 10%
  9. Multiple slow queries are frequently displayed at the same time.

Attachment:
Http://pan.baidu.com/s/1hq3tQDY
This is the current mysql running status, configuration parameters and some slow query logs

Please help me. I have been overwhelmed recently. thank you!

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.