SOURCE:http://bbs.aliyun.com/read/160831.html?spm=5176.7189909.0.0.0thnem&displaymode=1&page=1& Toread=1#tpc
Presumably, everyone is very concerned about this problem? 6psk2d0
on the RDS instance CPU exceeds 100%, The occasional stuck phenomenon occurs. This is usually caused by SQL performance problems, which I'll analyze below.
principle:Excessive CPU consumption is usually caused by slow SQL, where the slow SQL includes a full table scan, scanning data volume is too large, memory sequencing, disk sequencing, lock contention wait;
Behavior :SQL Execution Status: sending data,copying to TMP table,copying to TMPtable on disk,sorting result,locked;
Workaround: The user can log on to RDS, view the currently executing SQL through show processlist, and when the show Processlist is finished, a large number of statements usually appear sending the state data,copy ing to TMP table,copying-tmp table on disk,sorting result, Using Filesort is a performance issue with SQL;
a.sending data indicates that SQL is querying from a table, and if the query condition does not have an appropriate index, it can result in a lengthy SQL execution time;
b.copying to TMP table on disk: This state typically occurs because the temporary result set is too large to exceed the temporary memory size specified by the database and requires a copy of the temporary result set to disk, which requires the user to /c5>
c.sorting result, Using filesort: This state indicates that SQL is performing a sort operation, the sort operation causes a lot of CPU consumption, and the usual optimization method will add the appropriate index to eliminate the sorting or reduce the ordered result set;
throughproblems and solutions for SQL statements found by show Processlist because of the length of the space, pleasetheReduce CPU Usage Case study
"Go" "RDS Tutorial" Professional DBA Express-CPU Optimization Chapter