我正在我的从机器上运行这个查询。
查询:
select ID from audit where app='accounts'
解释输出
+----+-------------+-----------------+------+---------------+------+---------+------+-----------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-----------------+------+---------------+------+---------+------+-----------+-------------+
| 1 | SIMPLE | IAMAccountAudit | ALL | NULL | NULL | NULL | NULL | 155658522 | Using where |
+----+-------------+-----------------+------+---------------+------+---------+------+-----------+-------------+执行后,我的奴隶机器在主人后面运行。
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 182.31.251.94
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: bin.001487
Read_Master_Log_Pos: 2967065
Relay_Log_File: 172-relay-bin.004312
Relay_Log_Pos: 43303861
Relay_Master_Log_File: bin.001486
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 43303721
Relay_Log_Space: 55397036
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 365
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1302078还在不断增加。
如何避免mysql积压?
发布于 2013-01-29 10:03:09
如果我有一个要处理的表模式,它会有一点帮助。但是,从我所看到的情况来看,您的查询并不是使用索引,而是从第一条记录到最后一条记录依次读取表。
由于查询必须检查大约155,658,522或1.55亿行,这将导致服务器资源耗尽。由于查询在要查询的列上没有适当的索引(解释输出中的key= null ),所以行将得到一个一个接一个的读锁。
当这种读取发生时,MySQL可以阻止复制活动,即对read.MySQL行的块更新将排队,因为它们无法完成这些更新。这个问题是由于服务器的不兼容,而不是线程等原因造成的。因为我没有像引擎这样的表信息,这是最好的猜测。
建议:
希望这能帮点忙。
https://stackoverflow.com/questions/14577694
复制相似问题