mysql调优
show status\G;
binlog_cache_size=131072
tmp_table_size=104857600
max_connections=5000
sort_buffer_size=1048576
join_buffer_size=1048576
innodb_sort_buffer_size=2097152
thread_cache_size=64
---快速关闭mysql
让innodb把脏数据写入磁盘
innodb_max_dirty_pages_pct=0,默认是75
如果碰到group by报错:http://www.cnblogs.com/jim2016/p/6322703.html
SHOW engine InnoDB Status;
里面有:
Log sequence number 814 3121743145 Log flushed up to 814 3121092043 Last checkpoint at 814 2826361389 这里看到,当前的LSN是814 3121743145,最后一个检查点在814 2826361389,也就是说两者相差了3121743145-2826361389=295381756,那么意味着InnoDB还有很多Dirty Page需要Flush。
performance_schema:
events_stages_current,跟踪长时间操作的进度,比如alter table。
metadata_locks,元数据所,那些回话拥有哪些元数据锁,那些会话正在等待元数据锁,哪些请求由于死锁被杀掉,活着锁等待超时而被丢弃。
information_schema:
sys:
查看库的访问量:select table_schema,table_name,sum(io_read_requests+io_write_requests) from schema_table_statistics;
查看表的访问量:select table_schema,table_name,io_read_requests+io_write_requests from schema_table_statistics;
冗余索引检查:select * from sys.schema_redundant_indexes;
未使用的索引:select * from sys.schema_unused_indexes;
表自增id监控:select * from sys.schema_auto_increment_columns;
监控全表扫描的sql:select * from sys.statements_with_full_table_scans where db='y1da';
查看实例小号的磁盘io:select file,avg_read+avg_write as avg_io from io_global_by_file_by_bytes order by avg_io desc limit 10;
gtid:
全局事务标识符