根据这篇文章来操作。
准备条件:大于5.6.16版本的MySQL,登录mysql
开启
set GLOBAL innodb_status_output=ON;set GLOBAL innodb_status_output_locks=ON; 新增、修改表。
mysql> show create table my_test1_0\G*************************** 1. row ***************************Table: my_test1_0Create Table: CREATE TABLE `my_test1_0` (`id` int(11) NOT NULL,`col2` int(11) DEFAULT NULL,`col3` varchar(64) DEFAULT NULL,`col4` varchar(10) DEFAULT NULL,`col5` varchar(64) DEFAULT NULL,PRIMARY KEY (`id`),KEY `idx_col2` (`col2`),KEY `idx_col3_col4` (`col3`,`col4`)) ENGINE=InnoDB DEFAULT CHARSET=latin11 row in set (0.08 sec) insert into my_test1_0(id ) values( 1 ),(2),(3);update my_test1_0 set col5='jiji' where id=1;
查看
show engine innodb status\G
结果:
mysql> show engine innodb status\G*************************** 1. row *************************** Type: InnoDB Name:Status:=====================================2016-11-07 15:40:36 149c INNODB MONITOR OUTPUT=====================================Per second averages calculated from the last 0 seconds-----------------BACKGROUND THREAD-----------------srv_master_thread loops: 3 srv_active, 0 srv_shutdown, 1528929 srv_idlesrv_master_thread log flush and writes: 1528919----------SEMAPHORES----------OS WAIT ARRAY INFO: reservation count 19OS WAIT ARRAY INFO: signal count 18Mutex spin waits 142, rounds 276, OS waits 7RW-shared spins 9, rounds 221, OS waits 6RW-excl spins 1, rounds 150, OS waits 5Spin rounds per wait: 1.94 mutex, 24.56 RW-shared, 150.00 RW-excl------------TRANSACTIONS------------Trx id counter 22306Purge done for trx's n:o < 22306 undo n:o < 0 state: running but idleHistory list length 446LIST OF TRANSACTIONS FOR EACH SESSION:---TRANSACTION 0, not startedMySQL thread id 11, OS thread handle 0x149c, query id 239 localhost ::1 root intshow engine innodb status--------FILE I/O--------I/O thread 0 state: wait Windows aio (insert buffer thread)I/O thread 1 state: wait Windows aio (log thread)I/O thread 2 state: wait Windows aio (read thread)I/O thread 3 state: wait Windows aio (read thread)I/O thread 4 state: wait Windows aio (read thread)I/O thread 5 state: wait Windows aio (read thread)I/O thread 6 state: wait Windows aio (write thread)I/O thread 7 state: wait Windows aio (write thread)I/O thread 8 state: wait Windows aio (write thread)I/O thread 9 state: wait Windows aio (write thread)Pending normal aio reads: 0 [0, 0, 0, 0] , aio writes: 0 [0, 0, 0, 0] , ibuf aio reads: 0, log i/o's: 0, sync i/o's: 0Pending flushes (fsync) log: 0; buffer pool: 0480 OS file reads, 55 OS file writes, 33 OS fsyncs0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s-------------------------------------INSERT BUFFER AND ADAPTIVE HASH INDEX-------------------------------------Ibuf: size 1, free list len 0, seg size 2, 0 mergesmerged operations: insert 0, delete mark 0, delete 0discarded operations: insert 0, delete mark 0, delete 0Hash table size 553253, node heap has 1 buffer(s)0.00 hash searches/s, 0.00 non-hash searches/s---LOG---Log sequence number 2555311Log flushed up to 2555311Pages flushed up to 2555311Last checkpoint at 25553110 pending log writes, 0 pending chkp writes18 log i/o's done, 0.00 log i/o's/second----------------------BUFFER POOL AND MEMORY----------------------Total memory allocated 136052736; in additional pool allocated 0Dictionary memory allocated 101103Buffer pool size 8192Free buffers 7737Database pages 454Old database pages 0Modified db pages 0Pending reads 0Pending writes: LRU 0, flush list 0, single page 0Pages made young 0, not young 00.00 youngs/s, 0.00 non-youngs/sPages read 448, created 6, written 330.00 reads/s, 0.00 creates/s, 0.00 writes/sNo buffer pool page gets since the last printoutPages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/LRU len: 454, unzip_LRU len: 0I/O sum[0]:cur[0], unzip sum[0]:cur[0]--------------ROW OPERATIONS--------------0 queries inside InnoDB, 0 queries in queue0 read views open inside InnoDBMain thread id 3908, state: sleepingNumber of rows inserted 3, updated 1, deleted 0, read 10.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s----------------------------END OF INNODB MONITOR OUTPUT============================1 row in set (0.08 sec)mysql>