更新的时候报

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. 全新的membership框架Asp.net Identity(1)——.Net membership的历史

    在Asp.net上,微软的membershop框架经历了Asp.net membership到Asp.net simple membership,再到现在的Asp.net Identity. 每一次改 ...

  2. GConf error:Failed to contact configuration server

    Linux系统运行一直正常,但是图形界面使用root账号登录时遇到下面错误,第一次遇到这么怪异的状况 具体错误信息如下所示: GConf error:Failed to contact configu ...

  3. YourSQLDba开源项目发布到codeplex网站了

    今天登录YourSQLDba的官方网站http://yoursqldba.grics.ca/index_en.shtml,发现YourSQLDba项目已经发布到开源网站http://www.codep ...

  4. SQL Server跨库查询

    方式一: 语句 SELECT * FROM 数据库A.dbo.表A a, 数据库B.dbo.表B b WHERE a.field=b.field "DBO"可以省略 如 SELEC ...

  5. UNIX系统的显示时间何时会到达尽头

    本文分为三个小块: 一.UNIX系统中时间的存储形式: 二. time_t 的最大值是多少: 三. 将time_t 的最大值转化为真实世界的时间: #---------------------# # ...

  6. Linux下监控服务器状态命令——top

    ----------------------------------工作中常用的命令,来判断服务器状态是否正常------------------------------------- top命令作用 ...

  7. mysql 一些命令

    show processlist; 查看服务进程列表show engines; 所有提供的引擎show variables like '%storage_engine%'; 当前默认的存储引擎show ...

  8. Python urllib2 调试

    #!/usr/bin/env python # coding=utf-8 __author__ = 'zhaoyingnan' import urllib import urllib2 import ...

  9. git 设置代理服务器

    git可以通过以下命令设置代理服务器 git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:proxypo ...

  10. button