原文来源: http://www.mysqlperformanceblog.com/2006/07/17/show-innodb-status-walk-through/
译者:叶金荣(Email:),转载请注明译者和出处,并且不能用于商业用途,违者必究。
1.===================================== 2.060717 3:07:56 INNODB MONITOR OUTPUT 3.===================================== 4.Per second averages calculated from the last 44 seconds
说实在的我不喜欢InnoDB提供的平均值,因为很难取得合理的平均间隔统计值,如果你是写脚本来取得 SHOW INNODB STATUS 结果的话,那么最好取得全局的统计结果,然后取得平均值。当然了,直接查看输出的结果信息也是很有用的。
1.---------- 2.SEMAPHORES 3.---------- 4.OS WAIT ARRAY INFO: reservation count 13569, signal count 11421 5.--Thread 1152170336 has waited at ./../include/buf0buf.ic line 630 for 0.00 seconds the semaphore: 6.Mutex at 0x2a957858b8 created file buf0buf.c line 517, lock var 0 7.waiters flag 0 8.wait is ending 9.--Thread 1147709792 has waited at ./../include/buf0buf.ic line 630 for 0.00 seconds the semaphore: 10.Mutex at 0x2a957858b8 created file buf0buf.c line 517, lock var 0 11.waiters flag 0 12.wait is ending 13.Mutex spin waits 5672442, rounds 3899888, OS waits 4719 14.RW-shared spins 5920, OS waits 2918; RW-excl spins 3463, OS waits 3163
1.------------------------ 2.LATEST DETECTED DEADLOCK 3.------------------------ 4.060717 4:16:48 5.*** (1) TRANSACTION: 6.TRANSACTION 0 42313619, ACTIVE 49 sec, process no 10099, OS thread id 3771312 starting index read 7.mysql tables in use 1, locked 1 8.LOCK WAIT 3 lock struct(s), heap size 320 9.MySQL thread id 30898, query id 100626 localhost root Updating 10.update iz set pad='a' where i=2 11.*** (1) WAITING FOR THIS LOCK TO BE GRANTED: 12.RECORD LOCKS space id 0 page no 16403 n bits 72 index `PRIMARY` of table `test/iz` trx id 0 42313619 lock_mode X locks rec but not gap waiting 13.Record lock, heap no 5 PHYSICAL RECORD: n_fields 4; compact format; info bits 0 14. 0: len 4; hex 80000002; asc ;; 1: len 6; hex 00000285a78f; asc ;; 2: len 7; hex 00000040150110; asc @ ;; 3: len 10; hex 61202020202020202020; asc a ;; 15. 16.*** (2) TRANSACTION: 17.TRANSACTION 0 42313620, ACTIVE 24 sec, process no 10099, OS thread id 4078512 starting index read, thread declared inside InnoDB 500 18.mysql tables in use 1, locked 1 19.3 lock struct(s), heap size 320 20.MySQL thread id 30899, query id 100627 localhost root Updating 21.update iz set pad='a' where i=1 22.*** (2) HOLDS THE LOCK(S): 23.RECORD LOCKS space id 0 page no 16403 n bits 72 index `PRIMARY` of table `test/iz` trx id 0 42313620 lock_mode X locks rec but not gap 24.Record lock, heap no 5 PHYSICAL RECORD: n_fields 4; compact format; info bits 0 25. 0: len 4; hex 80000002; asc ;; 1: len 6; hex 00000285a78f; asc ;; 2: len 7; hex 00000040150110; asc @ ;; 3: len 10; hex 61202020202020202020; asc a ;; 26. 27.*** (2) WAITING FOR THIS LOCK TO BE GRANTED: 28.RECORD LOCKS space id 0 page no 16403 n bits 72 index `PRIMARY` of table `test/iz` trx id 0 42313620 lock_mode X locks rec but not gap waiting 29.Record lock, heap no 4 PHYSICAL RECORD: n_fields 4; compact format; info bits 0 30. 0: len 4; hex 80000001; asc ;; 1: len 6; hex 00000285a78e; asc ;; 2: len 7; hex 000000003411d9; asc 4 ;; 3: len 10; hex 61202020202020202020; asc a ;; 31. 32.*** WE ROLL BACK TRANSACTION (2)
1.------------------------ 2.LATEST FOREIGN KEY ERROR 3.------------------------ 4.060717 4:29:00 Transaction: 5.TRANSACTION 0 336342767, ACTIVE 0 sec, process no 3946, OS thread id 1151088992 inserting, thread declared inside InnoDB 500 6.mysql tables in use 1, locked 1 7.3 lock struct(s), heap size 368, undo log entries 1 8.MySQL thread id 9697561, query id 188161264 localhost root update 9.insert into child values(2,2) 10.Foreign key constraint fails for table `test/child`: 11., 12. CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`) ON DELETE CASCADE 13.Trying to add in child table, in index `par_ind` tuple: 14.DATA TUPLE: 2 fields; 15. 0: len 4; hex 80000002; asc ;; 1: len 6; hex 000000000401; asc ;; 16. 17.But in parent table `test/parent`, in index `PRIMARY`, 18.the closest match we can find is record: 19.PHYSICAL RECORD: n_fields 3; 1-byte offs TRUE; info bits 0 20. 0: len 4; hex 80000001; asc ;; 1: len 6; hex 0000140c2d8f; asc - ;; 2: len 7; hex 80009c40050084; asc @ ;;
1.------------ 2.TRANSACTIONS 3.------------ 4.Trx id counter 0 80157601 5.Purge done for trx's n:o <0 80154573 undo n:o <0 0 6.History list length 6 7.Total number of lock structs in row lock hash table 0 8.LIST OF TRANSACTIONS FOR EACH SESSION: 9.---TRANSACTION 0 0, not started, process no 3396, OS thread id 1152440672 10.MySQL thread id 8080, query id 728900 localhost root 11.show innodb status 12.---TRANSACTION 0 80157600, ACTIVE 4 sec, process no 3396, OS thread id 1148250464, thread declared inside InnoDB 442 13.mysql tables in use 1, locked 0 14.MySQL thread id 8079, query id 728899 localhost root Sending data 15.select sql_calc_found_rows * from b limit 5 16.Trx read view will not see trx with id>= 0 80157601, sees <0 80157597 17.---TRANSACTION 0 80157599, ACTIVE 5 sec, process no 3396, OS thread id 1150142816 fetching rows, thread declared inside InnoDB 166 18.mysql tables in use 1, locked 0 19.MySQL thread id 8078, query id 728898 localhost root Sending data 20.select sql_calc_found_rows * from b limit 5 21.Trx read view will not see trx with id>= 0 80157600, sees <0 80157596 22.---TRANSACTION 0 80157598, ACTIVE 7 sec, process no 3396, OS thread id 1147980128 fetching rows, thread declared inside InnoDB 114 23.mysql tables in use 1, locked 0 24.MySQL thread id 8077, query id 728897 localhost root Sending data 25.select sql_calc_found_rows * from b limit 5 26.Trx read view will not see trx with id>= 0 80157599, sees <0 80157595 27.---TRANSACTION 0 80157597, ACTIVE 7 sec, process no 3396, OS thread id 1152305504 fetching rows, thread declared inside InnoDB 400 28.mysql tables in use 1, locked 0 29.MySQL thread id 8076, query id 728896 localhost root Sending data 30.select sql_calc_found_rows * from b limit 5 31.Trx read view will not see trx with id>= 0 80157598, sees <0 80157594
1.-------- 2.FILE I/O 3.-------- 4.I/O thread 0 state: waiting for i/o request (insert buffer thread) 5.I/O thread 1 state: waiting for i/o request (log thread) 6.I/O thread 2 state: waiting for i/o request (read thread) 7.I/O thread 3 state: waiting for i/o request (write thread) 8.Pending normal aio reads: 0, aio writes: 0, 9. ibuf aio reads: 0, log i/o's: 0, sync i/o's: 0 10.Pending flushes (fsync) log: 0; buffer pool: 0 11.17909940 OS file reads, 22088963 OS file writes, 1743764 OS fsyncs 12.0.20 reads/s, 16384 avg bytes/read, 5.00 writes/s, 0.80 fsyncs/s
"16384 avg bytes/read" 是读请求的平均值。随机IO的话,每个页的大小是16K,全表扫描或索引扫描时的预读会导致这个值明显的增加。因此,它体现了预读的效率。
1.------------------------------------- 2.INSERT BUFFER AND ADAPTIVE HASH INDEX 3.------------------------------------- 4.Ibuf for space 0: size 1, free list len 887, seg size 889, is not empty 5.Ibuf for space 0: size 1, free list len 887, seg size 889, 6.2431891 inserts, 2672643 merged recs, 1059730 merges 7.Hash table size 8850487, used cells 2381348, node heap has 4091 buffer(s) 8.2208.17 hash searches/s, 175.05 non-hash searches/s
1.--- 2.LOG 3.--- 4.Log sequence number 84 3000620880 5.Log flushed up to 84 3000611265 6.Last checkpoint at 84 2939889199 7.0 pending log writes, 0 pending chkp writes 8.14073669 log i/o's done, 10.90 log i/o's/second
1.---------------------- 2.BUFFER POOL AND MEMORY 3.---------------------- 4.Total memory allocated 4648979546; in additional pool allocated 16773888 5.Buffer pool size 262144 6.Free buffers 0 7.Database pages 258053 8.Modified db pages 37491 9.Pending reads 0 10.Pending writes: LRU 0, flush list 0, single page 0 11.Pages read 57973114, created 251137, written 10761167 12.9.79 reads/s, 0.31 creates/s, 6.00 writes/s 13.Buffer pool hit rate 999 / 1000
检查点进程处理完之后需要刷新的旧内存页;独立内存页 - 独立的写内存页。
1.-------------- 2.ROW OPERATIONS 3.-------------- 4.0 queries inside InnoDB, 0 queries in queue 5.1 read views open inside InnoDB 6.Main thread process no. 10099, id 88021936, state: waiting for server activity 7.Number of rows inserted 143, updated 3000041, deleted 0, read 24865563 8.0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
这是在事务开始后,但是当前还没有活跃语句的情况,Innodb主线程的状态控制了系统操作调度的数量 - 刷新脏内存页、检查点、净化线程、刷新日志、合并插入缓冲等。 "state" 的值则表示了主线程当前的状态。