mysql> select @@tx_isolation;
+-----------------+
| @@tx_isolation |
+-----------------+
| REPEATABLE-READ |
+-----------------+
1 row in set (0.00 sec) Session 196: mysql> show create table mail;
+-------
| mail | CREATE TABLE `mail` (
`mailid` bigint(20) NOT NULL AUTO_INCREMENT,
`receiverid` int(10) unsigned NOT NULL,
`senderid` int(10) unsigned NOT NULL,
PRIMARY KEY (`mailid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 | mysql> insert into mail values(1,2222,3333);
Query OK, 1 row affected (0.00 sec) mysql> insert into mail values(2,333,3333);
Query OK, 1 row affected (0.00 sec) mysql> commit;
Query OK, 0 rows affected (0.00 sec) mysql> start transaction;
Query OK, 0 rows affected (0.00 sec) mysql> insert into mail values(3,333,3333);
Query OK, 1 row affected (0.00 sec) mysql> select connection_id();
+-----------------+
| connection_id() |
+-----------------+
| 196 |
+-----------------+
1 row in set (0.02 sec) Session 197: mysql> update mail set receiverid=193719371 where mailid=3;
ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
mysql> update mail set receiverid=193719371 where mailid=3;
ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
mysql> select connection_id();
+-----------------+
| connection_id() |
+-----------------+
| 197 |
+-----------------+
1 row in set (0.00 sec) mysql> update mail set receiverid=193719371 where mailid=3; 389253799,197,update mail set receiverid=193719371 where mailid=3,389253798,196,
mysql[192.168.11.187] blocking_thread[196] current_query[] blocking waiting_thread[197]'s update mail set receiverid=193719371 where mailid=3
,,,,,
,,,,,
,,,,,
,,,,,
,,,,,
,,,,,

mysql 更新唯一主键列 被堵塞的更多相关文章

  1. MySql数据库查询表信息/列信息(列ID/列名/数据类型/长度/精度/是否可以为null/默认值/是否自增/是否是主键/列描述)

    查询表信息(表名/表描述): SELECT table_name name,TABLE_COMMENT value FROM INFORMATION_SCHEMA.TABLES WHERE table ...

  2. MySQL中的主键,外键有什么作用详解

    MySQL中的主键,外键有什么作用详解 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 学关系型数据库的同学,尤其在学习主键和外键时会产生一定的困惑.那么今天我们就把这个困惑连根拔起 ...

  3. mysql索引之主键索引

    MySQL目前主要有以下几种索引类型:1.普通索引2.唯一索引3.主键索引4.组合索引5.全文索引 二.语句 CREATE TABLE table_name[col_name data type] [ ...

  4. mybatis的执行流程 #{}和${} Mysql自增主键返回 resultMap 一对多 多对一配置

    n Mybatis配置 全局配置文件SqlMapConfig.xml,配置了Mybatis的运行环境等信息. Mapper.xml文件即Sql映射文件,文件中配置了操作数据库的Sql语句.此文件需要在 ...

  5. day03 MySQL数据库之主键与外键

    day03 MySQL数据库之主键与外键 昨日内容回顾 针对库的基本SQL语句 # 增 create database meng; # 查 show databases; shwo create da ...

  6. Transactional Replication2:在Subscriber中,主键列是只读的

    在使用Transactional Replication时,Subscriber 被认为是“Read-Only”的 , All data at the Subscriber is “read-only ...

  7. 设置MySQL数据表主键

    设置MySQL数据表主键: 使用“primary key”关键字创建主键数据列.被设置为主键列不允许出现重复的值,很多情况下与“auto_increment”递增数字相结合.如下SQL语句所示: My ...

  8. SQL Server 创建约束图解 唯一 主键

    SQLServer中有五种约束,Primary Key约束.Foreign Key约束.Unique约束.Default约束和Check约束,今天使用SQL Server2008来演示下这几种约束的创 ...

  9. 关于MySQL自增主键的几点问题(上)

    前段时间遇到一个InnoDB表自增锁导致的问题,最近刚好有一个同行网友也问到自增锁的疑问,所以抽空系统的总结一下,这两个问题下篇会有阐述. 1. 划分三种插入类型 这里区分一下几种插入数据行的类型,便 ...

随机推荐

  1. 使用MySQL数据库将汉字转换成拼音的一个C语言小程序

    环境: mysql:mysql-5.1.65 centos:centos 6.5 编译命令: gcc -o chinesetopinyin chinesetopinyin.c -L/usr/lib/m ...

  2. 《RedHatLinux逻辑卷的管理》——一条龙服务

    首先建2分区 [root@localhost ~]# partx -d /dev/sdb error deleting partition 4: BLKPG: No such device or ad ...

  3. [转载]mysql慢日志文件分析处理

    原文地址:mysql慢日志文件分析处理作者:maxyicha mysql有一个功能就是可以log下来运行的比较慢的sql语句,默认是没有这个log的,为了开启这个功能,要修改my.cnf或者在mysq ...

  4. [Accessibility] Missing contentDescription attribute on image [可取行]失踪contentDescription属性图像

    问题描述: [Accessibility] Missing contentDescription attribute on image [可取行]失踪contentDescription属性图像 原因 ...

  5. [WinForm]为TextBox设置水印文字

    关键代码: using System; using System.Runtime.InteropServices; using System.Windows.Forms; namespace WinF ...

  6. 前端工程模块化——以一个php项目为例

    实现一个页面功能总是需要 JavaScript.CSS 和 Template 三种语言相互组织,所以我们真正需要的是一种可以将 JavaScript.CSS 和 Template 同时都考虑进去的模块 ...

  7. spring-cloud-feign案例

    主要依赖 <dependencyManagement> <dependencies> <dependency> <groupId>org.springf ...

  8. python学习之html从0开始(一)

    <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content ...

  9. 用JS写的放大镜

    代码如下 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta ...

  10. Head of a Gang (map+邻接表+DFS)

    One way that the police finds the head of a gang is to check people's phone calls. If there is a pho ...