Last active
January 14, 2021 10:50
-
-
Save sokil/2d9db3265738f3838361c6bd74fdfd44 to your computer and use it in GitHub Desktop.
Musql Slow Query Log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET GLOBAL slow_query_log = 'ON'; | |
select @@long_query_time; | |
SET GLOBAL long_query_time = 5; | |
select @@slow_query_log_file; | |
SET GLOBAL slow_query_log_file = '/path/filename'; | |
SET GLOBAL slow_query_log = 'OFF'; | |
show status like '%Con%'; | |
https://dev.mysql.com/doc/refman/8.0/en/server-status-variables.html | |
+-------------------------------------------------------+---------------------+ | |
| Variable_name | Value | | |
+-------------------------------------------------------+---------------------+ | |
| Aborted_connects | 0 | | |
| Connection_errors_accept | 0 | | |
| Connection_errors_internal | 0 | | |
| Connection_errors_max_connections | 0 | | |
| Connection_errors_peer_address | 0 | | |
| Connection_errors_select | 0 | | |
| Connection_errors_tcpwrap | 0 | | |
| Connections | 1101 | The number of connection attempts (successful or not) to the MySQL server. | |
| Locked_connects | 0 | | |
| Max_used_connections | 6 | The maximum number of connections that have been in use simultaneously since the server started. | |
| Max_used_connections_time | 2021-01-14 10:31:24 | | |
| Mysqlx_connection_accept_errors | 0 | | |
| Mysqlx_connection_errors | 0 | | |
| Mysqlx_connections_accepted | 0 | | |
| Mysqlx_connections_closed | 0 | | |
| Mysqlx_connections_rejected | 0 | | |
| Performance_schema_cond_classes_lost | 0 | | |
| Performance_schema_cond_instances_lost | 0 | | |
| Performance_schema_session_connect_attrs_longest_seen | 135 | | |
| Performance_schema_session_connect_attrs_lost | 0 | | |
| Secondary_engine_execution_count | 0 | | |
| Ssl_client_connects | 0 | | |
| Ssl_connect_renegotiates | 0 | | |
| Ssl_finished_connects | 0 | | |
| Threads_connected | 1 | | |
+-------------------------------------------------------+---------------------+ | |
Configuration in my.cnf: | |
max_connections - https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_max_connections | |
thread_cache_size - https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_thread_cache_size |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment