--askpass Prompt for a password when connecting to MySQL --[no]color -C Use terminal coloring (default) --config -c Config file to read --count Number of updates before exiting --delay -d Delay between updates in seconds --help Show this help message --host -h Connect to host --[no]inc -i Measure incremental differences --mode -m Operating mode to start in --nonint -n Non-interactive, output tab-separated fields --password -p Password to use for connection --port -P Port number to use for connection --skipcentral -s Skip reading the central configuration file --socket -S MySQL socket to use for connection --spark Length of status sparkline (default 10) --timestamp -t Print timestamp in -n mode (1: per iter; 2: per line) --user -u User for login if not current user --version Output version information and exit --write -w Write running configuration into home directory if no config files were loaded
innotop is a MySQL and InnoDB transaction/status monitor, like 'top' for MySQL. It displays queries, InnoDB transactions, lock waits, deadlocks, foreign key errors, open tables, replication status, buffer information, row operations, logs, I/O operations, load graph, and more. You can monitor many servers at once with innotop.
Switch to a different mode: A Dashboard I InnoDB I/O Info Q Query List B InnoDB Buffers K InnoDB Lock Waits R InnoDB Row Ops C Command Summary L Locks S Variables & Status D InnoDB Deadlocks M Replication Status T InnoDB Txns F InnoDB FK Err O Open Tables U User Statistics
Actions: d Change refresh interval q Quit innotop k Kill a query's connection r Reverse sort order n Switch to the next connection s Choose sort column p Pause innotop x Kill a query
Other: TAB Switch to the next server group / Quickly filter what you see ! Show license and warranty = Toggle aggregation # Select/create server groups @ Select/create server connections $ Edit configuration settings \ Clear quick-filters Press any key to continue
______________________________________ InnoDB Locks _______________________________________ ID Type Waiting Wait Active Mode DB Table Index Ins Intent Special 47 TABLE 0 00:00 03:55 IS test t 0 47 RECORD 0 00:00 03:55 S test t PRIMARY 0 rec but not gap 49 TABLE 0 00:00 04:12 IX test t 0 49 RECORD 0 00:00 04:12 X test t PRIMARY 0 rec but not gap
由上可看出,T1事务加了两把锁:表t上的表锁IS和共享记录锁S rec but not gap,T2事务也加了两把锁:表t上的表锁IX和记录前的排他间隙锁X rec but not gap。