当我出于报告目的执行一些查询时,有时这些查询需要 10 分钟,有时相同的查询需要几个小时,有时我们会收到诸如通信链接失败之类的错误。当我查看错误日志时,我发现下面的错误消息,如何修复它。
错误消息:
lock: 0x2b84f402e800:
lock: 0x2b84f401bb80:
lock: 0x2b84f401c410:
lock: 0x2b84f41d45f0:
lock: 0x2b84f41c1990:
lock: 0x22d657d0:
lock: 0x2308c650:
lock: 0x2b84f800d2c0:
lock: 0x22db4040:
lock: 0x22c0fa60:
lock: 0x22bc85a0:
lock: 0x22cf7710:
Key caches:
default
Buffer_size: 402653184
Block_size: 1024
Division_limit: 100
Age_limit: 300
blocks used: 19
not flushed: 0
w_requests: 1
writes: 1
r_requests: 160
reads: 19
handler status:
read_key: 8256766
read_next: 143651263
read_rnd 16764
read_first: 76853
write: 1941561
delete 306347
update: 1781864
Table status:
Opened tables: 149
Open tables: 142
Open files: 55
Open streams: 0
Alarm status:
Active alarms: 0
Max used alarms: 1
Next alarm time: 0
Memory status:
Non-mmapped space allocated from system: 368238592
Number of free chunks: 168
Number of fastbin blocks: 0
Number of mmapped regions: 31
Space in mmapped regions: 761421824
Maximum total allocated space: 0
Space available in freed fastbin blocks: 0
Total allocated space: 357157904
Total free space: 11080688
Top-most, releasable space: 5359328
Estimated memory (with thread stack): 1132281856
Events status:
LLA = Last Locked At LUA = Last Unlocked At
WOC = Waiting On Condition DL = Data Locked
Event scheduler status:
State : INITIALIZED
Thread id : 0
LLA : n/a:0
LUA : n/a:0
WOC : NO
Workers : 0
Executed : 0
Data locked: NO
Event queue status:
Element count : 0
Data locked : NO
Attempting lock : NO
LLA : init_queue:139
LUA : init_queue:149
WOC : NO
Next activation : never
140328 17:17:08 [Warning] IP address 'xxxx' could not be resolved: Name or service not known
140328 17:20:00 [Warning] IP address 'xxxx' could not be resolved: Name or service not known
140328 17:29:43 [Warning] IP address 'xxxx' could not be resolved: Name or service not known
140331 9:55:47 [Warning] IP address 'xxxx' could not be resolved: Name or service not known
140331 9:56:09 [Warning] IP address 'xxxx' could not be resolved: Name or service not known
140331 11:38:35 [Warning] IP address 'xxxx' could not be resolved: Name or service not known
140331 15:07:04 [Warning] IP address 'xxxx' could not be resolved: Name or service not known
最佳答案
如果您出于报告目的进行查询,则不应锁定任何记录。确保您在查询语句中使用 with (nolock)
。
关于mysql - 查询花费很长时间在错误日志中发现锁定代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22979945/