MySQL configuration optimization (1) -- slow log query

Source: Internet
Author: User
Tags mysql slow query log

MySQL configuration optimization (1) -- slow log query
(1) ERRLOG contains the related information when mysqd is started and stopped, and when the server encounters any serious error during running; you can use the -- log-error [= file_name] Option to specify the location where mysqld saves the error log file. If the file_name value is not specified, mysqld uses the error log name host_name.err and writes the log file to the data directory; # * Logging and Replication # Both location gets rotated by the cronjob. # Be aware that this log type is a performance killer. # As of 5.1 you can enable the log at runtime! # General_log_file =/var/log/mysql. log fg # general_log = 1 # Error log-shoshould be very few entries. log_error =/var/log/mysql/error. log
(2) BINLOG binary logs contain all statements that update data or have potentially updated data (for example, no DELETE matching any row. The statement is saved as an "Event" and describes data changes. root @ kallen:/# mysqlbinlog log-file
/*! 50530 SET @ SESSION. pseudo do_slave_mode = 1 */;
/*! 40019 SET @ session. max_insert_delayed_threads = 0 */;
/*! 50003 SET @ OLD_COMPLETION_TYPE = @ COMPLETION_TYPE, COMPLETION_TYPE = 0 */;
DELIMITER /*! */;
Mysqlbinlog: File 'Log-file' not found (Errcode: 2)
DELIMITER;
# End of log file
ROLLBACK/* added by mysqlbinlog */;
/*! 50003 SET COMPLETION_TYPE = @ OLD_COMPLETION_TYPE */; ddkosooodfdsfsfs
/*! 50530 SET @ SESSION. pseudo do_slave_mode = 0 */;
Root @ kallen :/#
(3) The slow query log contains all the log files of SQL statements whose execution time exceeds long_query_time. Obtaining the initial lock time is not counted as the execution time. Use the -- log-slow-queries [= file_name] Option to start it. If the file_name value is not given, the hostname is regarded by the MO, And the suffix is-slow. log. If the file name is provided but not the absolute path name, the file is written to the data directory. Root @ kallen:/var/log/mysql # mysqldumpslow log-file
Root @ kallen :~ # Mysqldumpslow/var/log/mysql/mysql-slow.log
Read ing mysql slow query log from/var/log/mysql/mysql-slow.log
Count: 1 Time = 0.88 s (0 s) Lock = 0.00 s (0 s) Rows = 0.0 (0), debian-sys-maint [debian-sys-maint] @ localhost
Select count (*) into @ discard from 'information _ scheme'. 'columns'

Count: 1 Time = 0.16 s (0 s) Lock = 0.00 s (0 s) Rows = 35.0 (35), debian-sys-maint [debian-sys-maint] @ localhost
Select concat ('s ',
TABLE_SCHEMA,'s ', TABLE_NAME,'s ')
From information_schema.TABLES where ENGINE ='s'
Root @ kallen :~ #

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.