One MySQL often uses commands
1. Open the Log
1) show global variables like "%genera%";
2)set global general_log=on;
3)set global general_log=off;
2. MySQL assumes that set autocommit=0 is open, then all statements must be in one transaction
3. Show Engine InnoDB status
1) http://imysql.cn/2008_05_22_walk_through_show_innodb_status
Analysis of two typical problems
1. Database waits for lock timeout lock wait timeout exceeded; Try restarting transaction
1). Adjust the order in which statements are run. Reduce lock wait time: It involves more database operations and larger transactions. The tables that have these locks timed out (multiple transactions may take the same row of tables, there will be lock waits) are placed on the last side of the transaction, and the lock is released when it runs out. Reduce lock wait time for other transactions
2). Slicing transactions:
3). Statement merging. Reduce Database Network Interaction: Multiple statements, and together. Use Multiquery, one query update
2. Deadlock issues
3. View issues that have not been submitted by the transaction
Mysql> Show engine InnoDB status \g
Querying the transaction ID for active
Appendix:
MySQL Lock analysis: http://hedengcheng.com/?p=771
Performance Optimization--mysql Database