zoukankan      html  css  js  c++  java
  • mysql锁监视器

    根据MySQL锁监视器这篇文章来操作。

    准备条件:大于5.6.16版本的MySQL,登录mysql

    开启 

    set GLOBAL innodb_status_output=ON;
    set GLOBAL innodb_status_output_locks=ON;

    新增、修改表。
    mysql> show create table my_test1_0G
    *************************** 1. row ***************************
    Table: my_test1_0
    Create 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=latin1
    1 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 statusG

    结果:

    mysql> show engine innodb statusG
    *************************** 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_idle
    srv_master_thread log flush and writes: 1528919
    ----------
    SEMAPHORES
    ----------
    OS WAIT ARRAY INFO: reservation count 19
    OS WAIT ARRAY INFO: signal count 18
    Mutex spin waits 142, rounds 276, OS waits 7
    RW-shared spins 9, rounds 221, OS waits 6
    RW-excl spins 1, rounds 150, OS waits 5
    Spin rounds per wait: 1.94 mutex, 24.56 RW-shared, 150.00 RW-excl
    ------------
    TRANSACTIONS
    ------------
    Trx id counter 22306
    Purge done for trx's n:o < 22306 undo n:o < 0 state: running but idle
    History list length 446
    LIST OF TRANSACTIONS FOR EACH SESSION:
    ---TRANSACTION 0, not started
    MySQL thread id 11, OS thread handle 0x149c, query id 239 localhost ::1 root in
    t
    show 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: 0
    Pending flushes (fsync) log: 0; buffer pool: 0
    480 OS file reads, 55 OS file writes, 33 OS fsyncs
    0.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 merges
    merged operations:
     insert 0, delete mark 0, delete 0
    discarded operations:
     insert 0, delete mark 0, delete 0
    Hash table size 553253, node heap has 1 buffer(s)
    0.00 hash searches/s, 0.00 non-hash searches/s
    ---
    LOG
    ---
    Log sequence number 2555311
    Log flushed up to   2555311
    Pages flushed up to 2555311
    Last checkpoint at  2555311
    0 pending log writes, 0 pending chkp writes
    18 log i/o's done, 0.00 log i/o's/second
    ----------------------
    BUFFER POOL AND MEMORY
    ----------------------
    Total memory allocated 136052736; in additional pool allocated 0
    Dictionary memory allocated 101103
    Buffer pool size   8192
    Free buffers       7737
    Database pages     454
    Old database pages 0
    Modified db pages  0
    Pending reads 0
    Pending writes: LRU 0, flush list 0, single page 0
    Pages made young 0, not young 0
    0.00 youngs/s, 0.00 non-youngs/s
    Pages read 448, created 6, written 33
    0.00 reads/s, 0.00 creates/s, 0.00 writes/s
    No buffer pool page gets since the last printout
    Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/
    
    LRU len: 454, unzip_LRU len: 0
    I/O sum[0]:cur[0], unzip sum[0]:cur[0]
    --------------
    ROW OPERATIONS
    --------------
    0 queries inside InnoDB, 0 queries in queue
    0 read views open inside InnoDB
    Main thread id 3908, state: sleeping
    Number of rows inserted 3, updated 1, deleted 0, read 1
    0.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>
  • 相关阅读:
    [Tips] kubeconfig合并
    某书补充题选做
    Card
    Ant Design Pro V5 使用 Cesium 地图开发包遇到加载widgets.css样式报错
    工作相关
    pc端谷歌浏览器长截图
    dao层与xml之间联系
    三周的大学生活,我到底是怎么过来的
    湖南大学推荐书《社会学大纲》阅读有感 其二
    湖南大学新生报到游记 其一
  • 原文地址:https://www.cnblogs.com/kongzhongqijing/p/6039210.html
Copyright © 2011-2022 走看看