博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mysql 有索引没走索引 更新锁全表
阅读量:5289 次
发布时间:2019-06-14

本文共 1766 字,大约阅读时间需要 5 分钟。

Session 1:mysql>  select connection_id();+-----------------+| connection_id() |+-----------------+|               2 |+-----------------+1 row in set (0.00 sec)mysql> start transaction;Query OK, 0 rows affected (0.00 sec)mysql> select * from t200 where phoneNo between 30 and 40 for update;+----+---------+-------------+--------+| sn | phoneNo | channelType | status |+----+---------+-------------+--------+| 30 | 30      |           2 |      1 || 34 | 34      |           3 |      2 || 39 | 39      |           3 |      2 |+----+---------+-------------+--------+3 rows in set (0.00 sec)mysql>  select @@tx_isolation; +-----------------+| @@tx_isolation  |+-----------------+| REPEATABLE-READ |+-----------------+1 row in set (0.00 sec)mysql> explain  select * from t200 where phoneNo between 30 and 40 for update;+----+-------------+-------+------+---------------+------+---------+------+------+-------------+| id | select_type | table | type | possible_keys | key  | key_len | ref  | rows | Extra       |+----+-------------+-------+------+---------------+------+---------+------+------+-------------+|  1 | SIMPLE      | t200  | ALL  | t200_idx1     | NULL | NULL    | NULL |   34 | Using where |+----+-------------+-------+------+---------------+------+---------+------+------+-------------+Session 2:mysql>  insert into t200 values(29,29,4,1);ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transactionmysql>  insert into t200 values(100,100,4,1);ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transactionmysql>  insert into t200 values(1000,1000,4,1);ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transactionmysql>  insert into t200 values(1000,1000,4,1);

转载于:https://www.cnblogs.com/zhaoyangjian724/p/6198938.html

你可能感兴趣的文章
关于Mysql select语句中拼接字符串的记录
查看>>
动态规划 例子与复杂度
查看>>
安装webpack-dev-server后,npm run dev报错
查看>>
[BZOJ4567][SCOI2016]背单词(Trie+贪心)
查看>>
15软工课后作业01—15100120
查看>>
git回退到某个版本并提交
查看>>
python学习笔记-day02 格式化输出
查看>>
《我是一只IT小小鸟》读后感
查看>>
Jquery元素选取、常用方法
查看>>
Swiper+自动播放+抓手形状
查看>>
progressDialog 为什么设置了setProgress()方法无反应?
查看>>
P126 练习4.1 E2
查看>>
从零开始编写自己的C#框架(26)——小结
查看>>
记录近期小改K-Means至MapReduce上的心得
查看>>
ArcGIS Runtime for Android开发教程V2.0(4)基础篇---MapView
查看>>
mvc route .html 后缀 404
查看>>
IE浏览器报Promise未定义
查看>>
STM32串口中断
查看>>
android5.0问题
查看>>
Android 使用PullToRefreshExpandableListView不能setAdapter的问题
查看>>