slow-log对mysql性能的影响

测试方案

在不加slow-log和加上slow-log对比mysql的性能

加slow-log的设置

mysql环境变量设置

set GLOBAL log_output = 'FILE,TABLE';

set GLOBAL long_query_time = 0;

crontab -e设置定时跑脚本go-collect-slowlog-linux

* * * * * cd /home/houbin/ &&  ./go-collect-slowlog-linux -dataSource "admin:LIUrong123@@tcp(10.111.48.141:3306)/mysql"

登陆到10.111.48.141:3306数据库查看到slow-log记录 select * from slow_log limit 1\G

mysql> select * from slow_log limit 1\G
*************************** 1. row ***************************
start_time: 2020-05-19 20:18:25
user_host: rdsadmin[rdsadmin] @ localhost []
query_time: 00:00:00
lock_time: 00:00:00
rows_sent: 0
rows_examined: 0
db:
last_insert_id: 0
insert_id: 0
server_id: 1369305001
sql_text: Ping
thread_id: 2901589
1 row in set (0.00 sec)

猜你喜欢

转载自www.cnblogs.com/liurong07/p/12919427.html