zoukankan      html  css  js  c++  java
  • 如何开始和结束一个事务,模拟一个事务,查看一下tps的变化

    开始事务前的提交事务数:

    mysql> SHOW GLOBAL STATUS LIKE '%com_comm%';

    +---------------+-------+

    | Variable_name | VALUE |

    +---------------+-------+

    | Com_commit | 109 |

    +---------------+-------+

    1 ROW IN SET (0.01 sec)

    mysql> SHOW GLOBAL STATUS LIKE '%com_roll%';

    +---------------------------+-------+

    | Variable_name | VALUE |

    +---------------------------+-------+

    | Com_rollback| 1 |

    | Com_rollback_to_savepoint | 0 |

    +---------------------------+-------+

    2 rows in set (0.01 sec)  

    如何开启一个事务:

    mysql> start transaction;

    Query OK, 0 rows affected (0.00 sec)

    mysql> delete from t1 where id =2;

    Query OK, 0 rows affected (0.00 sec)

    mysql> insert into t1 values(2,'dskl');

    Query OK, 1 row affected (0.03 sec)

    mysql> select * from t1;

    +----+------+

    | id | name |

    +----+------+

    | 2 | dskl    |

    | 3 | kljk    |

    | 4 | dsljk   |

    | 5 |sjdljok  |

    +----+---------+

    4 rows in set (0.01 sec)

    mysql> delete from t1 where id=4;

    Query OK, 1 row affected (0.00 sec)

    mysql> commit;

    Query OK, 0 rows affected (0.01 sec)

    事务提交后的事务数:

    mysql> show global status like '%com_comm%';

    +---------------+-------+

    | Variable_name | Value |

    +---------------+-------+

    | Com_commit | 110 |

    +---------------+-------+

    1 row in set (0.01 sec)

    mysql> show global status like '%com_roll%';

    +----------------+-------+

    | Variable_name| Value |

    +----------------+------+

    | Com_rollback | 1 |

    | Com_rollback_to_savepoint | 0 |

    +-----------------------+-------+

    1rows in set (0.01 sec) 

  • 相关阅读:
    引用传递函数值
    关于引用(python中的伪指针)的理解
    学生管理系统_排序后通过name删除列表里的字典
    学生管理系统(函数版)
    全局变量和局部变量的理解
    lambda隐藏函数的嵌套
    lambda函数常见用法
    函数的多个返回值
    函数的函数名重名
    函数的嵌套
  • 原文地址:https://www.cnblogs.com/5945yang/p/11346454.html
Copyright © 2011-2022 走看看