更新的时候报

Caused by: java.sql.BatchUpdateException: Transaction error, need to rollback. errno:1205 Lock wait timeout exceeded; try restarting transaction

update_time=now() where streaming_no=?

  

找半天,给streaming_no加上索引就好了

mysql> show index from T_VSOP_CUSTOMER_INFO_RECORD
-> ;
+-----------------------------+------------+--------------------+--------------+--------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+-----------------------------+------------+--------------------+--------------+--------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| T_VSOP_CUSTOMER_INFO_RECORD | 0 | PRIMARY | 1 | id | A | 2428448 | NULL | NULL | | BTREE | | |
| T_VSOP_CUSTOMER_INFO_RECORD | 1 | index_streaming_no | 1 | streaming_no | A | 2671571 | NULL | NULL | | BTREE | | |
+-----------------------------+------------+--------------------+--------------+--------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
2 rows in set

 

--未加索引的外键会存在的问题
1.引起全表锁。
2.当使用了on delete cascade,而且没有对子表加索引,要从父表中删除多行时,每删除一行就要扫描一次子表。
3.当你从父表查询子表,你会发现没有索引的话会使查询变慢。

--什么时候不需要对外键增加索引
1.不会从父表中删除行。
2.不会去更新父表的主键。
3.不会从父表连接到子表。

如果更新的where条件没有索引 则会产生表锁

Caused by: java.sql.BatchUpdateException: Transaction error, need to rollback. errno:1205 Lock wait timeout exceeded; try restarting transaction的更多相关文章

  1. pymysql.err.InternalError: (1205, 'Lock wait timeout exceeded; try restarting transaction')错误处理

    问题描述: 在使用pymysql库时,利用游标执行插入操作,产生错误,会出现pymysql.err.InternalError: (1205, 'Lock wait timeout exceeded; ...

  2. Mysql错误: ERROR 1205: Lock wait timeout exceeded try restarting transaction解决办法

    select * from information_schema.INNODB_TRX;show full processlist;//找出目前连接的列表kill ID//根据ID kill掉

  3. Mysql错误: ERROR 1205: Lock wait timeout exceeded; try restarting transaction

    MySQL:innodb的事务锁,一个线程占用着,简单做法是:执行mysql命令: show full processlist; 然后找出查询语句的系统id:kill掉被锁住的线程id:kill 12 ...

  4. SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction 解决方法

    SHOW FULL PROCESSLIST; KILL 263071

  5. Mysql Lock wait timeout exceeded; try restarting transaction的问题

    今天在后台跑任务的时候,发现了数据库报错1205 - Lock wait timeout exceeded; try restarting transaction.问题原因是因为表的事务锁,以下是解决 ...

  6. 'Lock wait timeout exceeded; try restarting transaction'问题

    OperationalError: (1205, 'Lock wait timeout exceeded; try restarting transaction') 原因很简单,太多错误,意外处理没有 ...

  7. MySQL应用报错:java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction

    开发反馈,某业务系统插入一条记录的时候,日志报错,插入失败: ### Error updating database. Cause: java.sql.SQLException: Lock wait ...

  8. java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction

    java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction问题 1.问题描述 执行了几条update语句 ...

  9. ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction解决办法

    一.问题描述: 同事反馈线上一个表有其中一条数据无法删除,其他都正常,我拿到删数据的sql,尝试执行,报错如下: mysql> delete from facebook_posts where ...

随机推荐

  1. ORACLE等待事件: log file parallel write

    log file parallel write概念介绍 log file parallel write 事件是LGWR进程专属的等待事件,发生在LGWR将日志缓冲区(log_buffer)中的重做日志 ...

  2. [20141121]无法通过powershell读取sql server性能计数器问题

    背景: 全新服务器,需要增加性能监控,发现无法通过powershell读取性能指标 解决方法: Open the Registry Editor by going to the Start Menu ...

  3. php时间

    date_default_timezone_set('PRC'); //默认时区 //当前的时间增加5天 $date1 = "2014-11-11"; echo date('Y-m ...

  4. I2C基础知识

    常识 两条总线线路:串行数据总线SDA,串行时钟总线SCL 每个连接到总线的器件都有唯一的地址供其他设备寻址 每个连接到总线的器件都可以作为发送器和接收器 是多主机总线,如果两个或更多主机同时初始化, ...

  5. 使用ansible编译安装运维工具tmux

    实验系统:CentOS 6.6_x86_64 实验前提:提前准备好编译环境,防火墙和selinux都关闭 软件介绍:tmux是一个优秀的终端复用软件,类似GNU Screen,但来自于OpenBSD, ...

  6. Linux初学:(一)Linux概述

    Linux各个目录的结构介绍 Linux系统以目录的方式来组织和管理系统中的所有文件.Linux系统通过目录将系统中的所有的文件分级.分层组织在一起,形成了Linux文件系统的树形结构层次.以根目录“ ...

  7. 【java开发】分支语句、循环语句学习

    一.Java分支语句类型 if-else 语句 switch 关于if-esle语句可以拆分为三种 if语句 if(条件){语句块;} if-else语句if(条件语句){语句块;} if-else ...

  8. Cinder 调试 - 无法挂载到虚拟机

    1.问题 我们有时候在通过云主机挂载云硬盘的时候会出现挂载不上的问题.像这中问题有多种情况导致的. 看一下我遇到的两种情况. 1.权限问题 在cinder节点查看 /var/log/cinder/ci ...

  9. 疑似easyui本身bug:easyui时间控件问题,试了几个版本都不行

    最近发现easyui时间控件的值格式不支持带斜杠的日期(2016/10/31),必须是2016-10-31这类的才能正常使用,否则默认初始化为当前时间 <input id="Retur ...

  10. OpenStack 企业私有云的若干需求(6):大规模扩展性支持

    本系列会介绍OpenStack 企业私有云的几个需求: 自动扩展(Auto-scaling)支持 多租户和租户隔离 (multi-tenancy and tenancy isolation) 混合云( ...