mysql system lock_关于数据库 System lock 状态的说明和处理方式 | 学步园

关于数据库 System lock 状态的说明和处理方式

@2010-08-24 for&ever

A、对于MySQL来说:

执行命令show processlist ,可以看到当前的MySQL进程中有好多System lock的状态。

查询MySQL手册:

System lock

The thread is going to request or is waiting for an internal or external system lock for the table. If this state is being caused by requests for external locks and you are not using multiple mysqld servers that are accessing the same tables, you can disable external system locks with the --skip-external-locking option. However, external locking is disabled by default, so it is likely that this option will have no effect. For SHOW PROFILE, this state means the thread is requesting the lock (not waiting for it).

因此,如果不是几个 mysqld 服务共用一个表文件,可以通过设置参数--skip-external-locking 来禁止系统锁定

B、对于 InforBright来说:

有如下的说法:

IB has only table-level locks. When doing any write operation to a table an exlusive lock is set on it and any other queries needing this table must wait until the writing transaction commits. And vice versa - if a table is used for reading, loading must wait.

I can only suggest, that instead of inserts you can use LOAD command - it runs much faster than inserts. It maybe easier then to find a window between reports to run a load successfully.

You can also use two symmetrical databases. Reporting from one while loading to another. Surely, each load must be done twice then, so thye databases are eventually identical.

也就是说:

InfoBright 会优先读,因此在LoadData的时候(也就是写数据的时候)会被锁定。

那么,如果当前出现了锁定状态,造成写数据的进程始终无法完成,怎么办呢?

很简单,在写数据的时候,只要暂停一下读写,等写完数据再读取即可。

@2010-8-24 forandever

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值