数据库SQL性能应该监控哪些关键指标?

中等SQL

答题要点

关键指标:

-- 1. 查询执行时间
SHOW STATUS LIKE 'Slow_queries';
SELECT * FROM performance_schema.events_statements_summary_by_digest
ORDER BY SUM_TIMER_WAIT DESC LIMIT 10;

-- 2. 连接数
SHOW STATUS LIKE 'Threads_%';
SHOW STATUS LIKE 'Max_used_connections';

-- 3. 缓冲池命中率
SHOW STATUS LIKE 'Innodb_buffer_pool_%';
-- 命中率 = (1 - reads/read_requests) * 100

-- 4. 锁等待
SELECT * FROM information_schema.innodb_lock_waits;

-- 5. 复制延迟
SHOW SLAVE STATUS\G  -- Seconds_Behind_Master

完整解析在题库里看

核心知识点、易错点和面试官想听到什么;练过的题会进入记录,答错的进错题本。

去练这道题

回知识库看这一块

同一能力的其他题