As we all know, in the case of large traffic, can add node or change the schema can effectively alleviate the database pressure, but all the origin, all from a single MySQL start. The following summarizes some of the experiences that have been used
As we all know, in the case of large traffic, can add node or change the schema can effectively alleviate the database pressure, but all the origin, all from a single MySQL start. The following summarizes some of the experiences that have been used
Written in the firstAbout the start and configuration of slow SQL before I clean up the article:Http://www.cnblogs.com/hanxiaobei/p/5515624.htmlPrerequisite Preparation:tomcat7.xMysql--perfteachJmeterTest interface:
First, the environmentOs:centos Release 5.8 (64-bit)db:mysql5.5.17Second, the operation Delete the slow query log directly from the command rm-fThird, problems ariseSlow query log is not automatically generated, (if there is a backup, copy back
sometimes we're less efficient in locating systems. Query syntax, you need to open the slow query log, which is slowquery Log . The command to open the slow query log is as follows:ViewMysql> showvariables like '%slow% ';+---------------------+------
Edit the my. cnf or my. ini file and remove the comments of the following lines of code:Copy codeThe Code is as follows:Log_slow_queries =/var/log/mysql/mysql-slow.log.Long_query_time = 2Log-queries-not-using-indexes This will record slow queries
In web development, we often write some SQL statements. A bad SQL statement may make your entire program very slow. After 10 seconds, users usually choose to close the webpage, how to optimize SQL statements to find out SQL statements that have been
The most basic is mysql's mysqlslowdump
Easy to use:
Mysqldumpslow-s c-t 20 host-slow.log
Parameters:
1.-s, sorting, c, t, l, r, and ac, at, al, and ar are sorted by query times, time, lock time, and returned records respectively. Adding a is
Slow Query Optimization of MySQL is a common topic. This article describes the actual problems encountered in the production database and provides examples.
Enable slow query supportFirst, activate the slow query log, modify the my. CNF
Enable the slow query record function. Next, let's analyze the content of the slow query:
Select count (distinct. name) from cp_paycard as a left join cp_reservation as B on. uid = B. UID where. type = 2 and B. cpparkid = '000000' and B.
As the data volume continues to grow, performance is particularly important. Perhaps after optimization and good solutions, you cannot feel the existence of performance problems, but as the data volume continues to grow,
From millions to tens of
Discuz is slow. when MySQL is frequently rushed to MySQL 100%, find the cause. Here, we will first write down the slow query log of MySQL on a Windows host, as shown below:Run the CMD command line in the bin directory of MySQL. net stop mysql. Find
In web development, we often write some SQL statements. A bad SQL statement may make your entire program very slow. After 10 seconds, users usually choose to close the webpage, how to optimize SQL statements to find out SQL statements that have been
Enable slow log
There are two activation methods:
1. In my. cnf, log-slow-queries [= file_name]2. When the mysqld process is started, specify the five common tools to be compared using the -- log-slow-queries [= file_name] Option.
Mysqldumpslow,
In windows, mysql5620 used mysqldumpslowpl to analyze slow logs. Today, we see a tool pt-query-digest, which was originally intended to be installed and used on windows. The result is to run C on windows: before ProgramFilesMySQLMySQLServer56b,
As we all know, MYSQL's slow droptable operations know, Ext3 is not the most effective file system. for example, deleting files is very slow (it is really a painful process, isn't it ?), Resulting in a large number of random I/O. However, sometimes
Enable slow LogThere are two ways to enable: 1, in MY.CNF through Log-slow-queries[=file_name] 2, when mysqld process starts, specify the--log-slow-queries[=file_name] option
Five common tools for comparisonMysqldumpslow, Mysqlsla, Myprofi,
Because development performs Stability Construction for a system, it is necessary to audit the slow logs of the database system and check and optimize the system. Communicate with developers and select the recipient who regularly sends slow queries
Because development performs stability construction for a system, it is necessary to audit the slow logs of the database system and check and optimize the system. Communicate with developers by regularly sending slow queries to the developed email
Factors that affect slow SQL queries1, no index or invalid index caused by the full table scan.2. The amount of data and the number of tables associated with the table.Index is invalid1. When a table is associated with a query, the field type or
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.