tool.Mysqldumpslow-s r-t 10/var/lib/mysql/localhost-slow.log | More, return the result as shown.3.1.3 Pt-query-digest ToolsMore information than the Mysqldumpslow feedback.Pg-query-digest--help View Help to view the use command.Pg-query-digest/var/lib/mysql/localhost-slow.log, the query results are as follows.The firs
In the optimization query, database applications (such as MySQL) mean the operation and use of the tool. Using indexes, using explain to analyze and query, and adjusting the internal configuration of MySQL can optimize the query.
Any database programmer has the following experience: a bad SQL
Tag: SEL Access SQL statement through Date diff Union All database table variableIn a TENS database search, how to improve the efficiency of the query?1 ) Database design aspects: A, to optimize the query, should try to avoid full table scan, first of all should consider the where and order by the columns involved in the index.b, you should try to avoid the null value of the field in the Where clause to jud
The following articles mainly describe five useful methods for MySQL query optimization. Anyone familiar with SQL statements knows that if you want to operate a task, SQL statements can be written in many ways, but the query performance varies with different writing methods.
This article lists five MySQL query
Label:First, why the query slowNetwork, CPU calculation, generated statistics, execution technology, lock wait, io wait, etc.Second, slow query optimization access to inefficient query processing methods:
Confirm that you have accessed too many rows, or too many columns
Have you analyzed a large amount of
size of the cache block. is a "double-edged sword", the default is 4KB, set the value of large data query is good, but if your query is small data query, it is easy to create memory fragmentation and waste.
4. Several rates
Query Cache Hit rate =qcache_hits/(qcache_hits+qcache_inserts)
We all know that in MySQL database query optimization, the actual application of the database {for example, MySQL (the best combination with PHP)} means the actual operation and use of related tools. Using indexes and using EXPLAIN to analyze queries and adjust the internal configuration of MySQL (the best combination with PHP) can optimize queries.
Any database programmer has the following experience: a b
Recently, due to the need for work, we began to focus on the relative optimization of select query statements for MySQL databases.Because of the actual project involved, it is found that when the data volume of MySQL table reaches millions, the efficiency of normal SQL query decreases linearly, and the query speed is s
method.
Number of rows scanned and number of rows returned: General 1:1-->1:10.
Number of rows scanned and types of access: the difference in the number of scanned rows for different accesses to the same row of data (scan table, index, scope access, unique index, Changshu reference, single-value access), usually increasing the index is the most straightforward method. Query optimization tips fo
The MySQL Query optimization program [group chart] analyzes a selection row query to see if it can be optimized to make it run faster. This article will study how the query optimization program works. For more information, see "Getting Maximum Performance from MySQL" in MySQ
(graphics and text), many things will be clear.
Summary:There may be a variety of SQL statements that implement the same query function. If you determine which optimization method you want to perform, if you only test it in time, it will be affected by many external factors. We understand how to execute MSSQL, i/O logic reading, querying the graph query plan,
Index is the most important tool for improving the query speed. Of course there are other technologies available for use, but in general, the biggest performance difference is the correct use of indexes. In the MySQL Mail List, people often ask for methods that make queries run faster. In most cases, we should doubt whether there are any indexes on the data table, and usually solve the problem immediately after adding the index. Of course, it is not a
the DBMS to convert data at runtime. Conversion of the same character and integer data.
48. query Association and write order
Select a. personmemberid, * From chineseresume A, personmember B where personmemberid= B. referenceid and A. personmemberid = 'jcnprh1_1' (A = B, B = 'number ')Select a. personmemberid, * From chineseresume A, personmember B where a. personmemberid= B. referenceid and A. personmembe
MySQL query optimization: profile function
MySQL query optimization: profile function. Note that you need to install the profile module.
1. The version is later than 5.0.37. (Show profiles and show profile were added in MySQL 5.0.37 .)
SELECT @ profiling;To check whether the profile has been enabled. If the profilng va
minutes long.
The method I used is mainly for testing. I also read the JAVA code and use Log4j and Perf4j logs to view the time used by each SQL statement, find the performance bottleneck, and then optimize it in a targeted manner.
The most effective optimization of the query is the establishment of an index, and the ID is the auto-increment and primary key, which has already been done by the predecessors.
Existing methods:
Start time [@start_dt] End time [@end_dt]
other conditions []
Total query data: [XXXX]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19-20
Disadvantages:
If you have 1000 data, each page shows 50, you need to display 20 page connections.
The
In our usual SQL query, in fact, we have a lot to pay attention to the principle, since the implementation of SQL query optimization , this article will introduce 30 query optimization principles.The first principle to be noted1. To optimize the
uses the same method to optimize both queries, in fact, the MySQL optimizer will handle the internalthese two types of queries are converted to each other. They can all use indexes to optimize, which is also the most effective optimization method. Optimizing group by with RollupA variant of the group query is to ask MySQL to do a super-aggregation of the returned grouped results again. You can use the WIT
storing the time with a string, and storing the IP address with an integer data type. (3) Try to avoid null: The column should be specified as NOT NULL unless you want to store null. In MySQL. Columns that contain null values are very difficult to query optimization. Because they make indexes, index statistics, and comparison operations more complex. You should replace the null value with 0, a special valu
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.