MySQL5.7 Waiting FOR TABLE FLUSH
系統不能使用,資料庫上99%的會話等待是Waiting FOR TABLE FLUSH,找到等待時間最長的會話kill,系統恢復正常。是什麼原因造成的呢?
日誌分析:
Time: 2018-12-15T10:45:50.116723+08:00
User@Host: gg[gg] @ [10.92.221.131] Id: 9435656
Query_time: 58475.741298 Lock_time: 0.000561 Rows_sent: 0 Rows_examined: 32858598152
SET TIMESTAMP=1544841950;
CALL PRO_COUNT_XXXXX
();
Time: 2018-12-15T10:45:50.128296+08:00
User@Host: root[root] @ [10.92.221.125] Id: 9440022
Query_time: 31548.800341 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0
SET TIMESTAMP=1544841950;
FLUSH /*!40101 LOCAL */ TABLES;
從日誌上分析猜測是flush tables跟慢的SQL相互影響導致的問題。因為flush table會關閉所有的表,包括正在使用的表,並且會flush query cache,正在執行的SQL是正在開啟表,所以flush tables被堵塞,它進而堵塞了後面的查詢。實驗驗證:
session1:
INSERT INTO test1 SELECT a.* FROM test a,test b; #test表是一張幾十萬資料的表
session2:
FLUSH TABLES;
session3:
SELECT * FROM test;
session4:
SELECT * FROM test;
session5:
SHOW PROCESSLIST
Id USER HOST db Command TIME State Info
1 root localhost:48463 test QUERY 48 Waiting FOR TABLE FLUSH FLUSH TABLES
2 root localhost:48480 test SLEEP 124 (NULL)
3 root localhost:48490 test QUERY 73 Sending DATA INSERT INTO test1 SELECT a.* FROM test a,test b
4 root localhost:48491 test QUERY 37 Waiting FOR TABLE FLUSH SELECT * FROM test
6 root localhost:48496 test QUERY 0 init SHOW PROCESSLIST
8 root localhost:48504 test QUERY 8 Waiting FOR TABLE FLUSH SELECT * FROM test
相關文章
- MySQL:Analyze table導致'waiting for table flush'MySqlAI
- MySQL5.7 Waiting for global read lockMySqlAI
- MySQL新增索引偶遇waiting for table metadata lockMySql索引AI
- MySQL DDL Waiting for table metadata lock 解決MySqlAI
- mysql關於FLUSH TABLES和FLUSH TABLES WITH READ LOCK的理解MySql
- Waiting for target device to come onlineAIdev
- ALTER SYSTEM FLUSH BUFFER_POOL
- MySQL:unblock with 'mysqladmin flush-hosts'MySqlBloC
- innodb_flush_log_at_trx_commitMIT
- InnoDB引擎之flush髒頁
- MySQL5.7下面,誤操作導致的drop table db1.tb1; 的恢復方法:MySql
- MySQL學習之flush(刷髒頁)MySql
- create table,show tables,describe table,DROP TABLE,ALTER TABLE ,怎麼使用?
- ORA-04021: timeout occurred while waiting to lock objectWhileAIObject
- MySQL Cases-記錄大量waiting for handler commitMySqlAIMIT
- cache操作:clean、invalidate與flush的含義
- session效能的影響,後臺 flush dirtySession
- 使用 BufferedWriter 記得輸出文字時 flush()
- Error waiting for a debug connection: ProcessException: adb did not report forwarded portErrorAIExceptionForward
- Oracle例項關閉:SHUTDOWN: waiting for active calls to completeOracleAI
- PAT甲級-1014. Waiting in Line (30)(模擬)AI
- Failed to connect to ESP8266: Timed out waiting for packet headerAIHeader
- MySQL5.7 多例項MySql
- yum install mysql5.7MySql
- table
- PostgreSQL DBA(66) - 配置引數(checkpoint_flush_after)SQL
- 非易失性WAL BUFFER解析:flush WAL改造
- flush 快取對inmemory有什麼影響?快取
- yum 提示 Another App is currently holding the yum lock; waiting for it to exit...APPAI
- MySQL:簡單記錄一下Waiting for commit lockMySqlAIMIT
- MySQL5.7: sql script demoMySql
- centos安裝mysql5.7CentOSMySql
- mysql5.7 安裝教程MySql
- [20231023]備庫與alter system flush buffer_cache.txt
- Netty原始碼解析 -- ChannelOutboundBuffer實現與Flush過程Netty原始碼
- 刪除表時碰到lms flush message acks等待事件事件
- innodb_flush_log_at_trx_commit引數的直白理解MIT
- Sparse Table