mysqlperformance
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| mysqlperformance [2019/03/10 20:45] – z0hpvk | mysqlperformance [2025/03/08 22:24] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 6: | Line 6: | ||
| {{youtube> | {{youtube> | ||
| - | Default configuration values for MySQL 5.7 .. | + | ==== Slow Query Log Analysis ==== |
| < | < | ||
| - | auto_increment_increment | + | wget percona.com/ |
| + | chmod 750 pt-query-digest \\ | ||
| + | ./ | ||
| + | </ | ||
| + | |||
| + | ==== Performance Schema Scripts ==== | ||
| + | <code SQL> | ||
| + | -- Unused Indexes | ||
| + | select * from sys.schema_unused_indexes; | ||
| + | |||
| + | select object_schema, | ||
| + | from performance_schema.table_io_waits_summary_by_index_usage | ||
| + | where index name is not null and count_star = 0 | ||
| + | order by object_schema, | ||
| + | |||
| + | -- Queries not using Indexes | ||
| + | SELECT THREAD_ID TID, SUBSTR(SQL_TEXT, | ||
| + | | ||
| + | FROM performance_schema.events_statements_history | ||
| + | WHERE NO_INDEX_USED=1 OR NO_GOOD_INDEX_USED=1; | ||
| + | |||
| + | -- Queries using Full Table Scans | ||
| + | SELECT query, db, total_latency, | ||
| + | FROM sys.statements_with_full_table_scans | ||
| + | WHERE db not in (' | ||
| + | ORDER BY last_seen DESC limit 50; | ||
| + | |||
| + | -- Process List | ||
| + | SELECT PROCESSLIST_ID AS id, | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | FROM performance_schema.threads | ||
| + | WHERE PROCESSLIST_ID IS NOT NULL AND PROCESSLIST_COMMAND NOT IN (' | ||
| + | ORDER BY PROCESSLIST_TIME ASC; | ||
| + | |||
| + | -- Hot Databases (Disk Utilisation) | ||
| + | select sys.extract_schema_from_file_name(file_name) as table_schema, | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | from performance_schema.file_summary_by_instance | ||
| + | group by table_schema | ||
| + | order by io_write_requests DESC limit 20; | ||
| + | |||
| + | -- Hot Tables (Disk Utilisation) | ||
| + | select concat(sys.extract_schema_from_file_name(file_name),' | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | from performance_schema.file_summary_by_instance | ||
| + | group by unique_table_name | ||
| + | order by io_write_requests DESC limit 20; | ||
| + | |||
| + | -- User Reports | ||
| + | select * from sys.user_summary limit 10; | ||
| + | |||
| + | select user, | ||
| + | from sys.user_summary_by_statement_type limit 100; | ||
| + | |||
| + | -- Active Queries | ||
| + | SELECT CONCAT_WS( | ||
| + | '','# | ||
| + | ,'# User@Host: ', | ||
| + | ,'# Schema: ', | ||
| + | ,'# Query_time: ', | ||
| + | ,'# Tmp_tables: ', | ||
| + | ,'# Full_scan: ', | ||
| + | , t.PROCESSLIST_INFO,';' | ||
| + | FROM performance_schema.events_statements_history s | ||
| + | JOIN performance_schema.threads t using(thread_id) | ||
| + | WHERE t.TYPE = ' | ||
| + | AND t.PROCESSLIST_INFO IS NOT NULL | ||
| + | AND t.PROCESSLIST_ID != connection_id() | ||
| + | ORDER BY t.PROCESSLIST_TIME desc; | ||
| + | </ | ||
| + | |||
| + | ==== Default configuration values ==== | ||
| + | My SQL 5.7.25, Windows Zip Installation. \\ | ||
| + | |||
| + | | auto_increment_increment | ||
| + | | auto_increment_offset | ||
| + | | autocommit | ||
| + | | automatic_sp_privileges | ||
| + | | avoid_temporal_upgrade | ||
| + | | back_log | ||
| + | | basedir | ||
| + | | big_tables | ||
| + | | bind_address | ||
| + | | binlog_cache_size | ||
| + | | binlog_checksum | ||
| + | | binlog_direct_non_transactional_updates | ||
| + | | binlog_error_action | ||
| | binlog_format | | binlog_format | ||
| | binlog_group_commit_sync_delay | | binlog_group_commit_sync_delay | ||
| Line 509: | Line 615: | ||
| | version_compile_os | | version_compile_os | ||
| | wait_timeout | | wait_timeout | ||
| - | | warning_count | + | | warning_count |
mysqlperformance.1552250730.txt.gz · Last modified: (external edit)
