Unconsciously played two years of MySQL, found that a lot of people say that MySQL compared to Oracle, the optimizer does a poor job, in fact, in a way, indeed, But after all, MySQL only to 5.7 version, Oracle has developed to 12c, today I looked at the MySQL connection algorithm, well, now still do not support hash
MySQL learning footprint record 14-table alias and self-join table used in this query: The following table num represents the bus route, such as 1 car, 2 car, stop with table parking site, such as Station A and Station B:
route;+------+------+| num | stop |+------+------+| 1 | A || 1 | B || 1 | C || 2 | B || 2 | C || 2 | D |+------+------+
Prerequisites 1. Use the table
MySQL Nested-Loop Join algorithm learning, nested-loopjoin
After playing MySQL for more than two years, I found that many people say that MySQL is inferior to Oracle in terms of optimizer. In fact, to some extent, it is true, however, after all, MySQL is only available in ve
Mysql database performance optimization 3 (Table sharding, Incremental backup, and restoration), mysql Performance Optimization
Next, Mysql database performance optimization 2
Horizontal table Division
If a table contains too many
whenever possible, so that the database does NOT need to compare NULL values during future queries.Some text fields, such as "province" or "gender", can be defined as ENUM. In MySQL, the ENUM type is processed as the numeric data, and the numeric data is processed much faster than the text type. In this way, we can improve the performance of the MySQL database.2
Mysql performance optimization 3 (Table sharding, Incremental backup, and restoration), mysql Performance OptimizationHorizontal table Division
If a table contains too many records, for example, tens of millions of records and needs to be searched frequently, it is necessary to convert them to zero. If I split 100 tabl
is best indexed, otherwise the query speed can be guaranteed only by creating a hash table by sorting, merging, or scanning orders tables. For the Orders table, also filter for order dates: If the optimizer is smarter, it will filter out some data before joining (join), thereby reducing the amount of data to be processed later; a less intelligent optimizer may make a connection and then filter it, in which case the filter condition is specified in th
MEDIUMINT instead of BIGIN to define integer fields.
Another way to improve efficiency is to set the field to not null whenever possible, so that the database does NOT need to compare NULL values during future queries.
Some text fields, such as "province" or "gender", can be defined as ENUM. In MySQL, the ENUM type is processed as the numeric data, and the numeric data is processed much faster than the text type. In this way, we can improve the d
MySQL Using temporary; Using filesort inner join optimization, filesortinnerProblem
Using the show full processlist statement, you can easily find the problematic SQL statement, as shown below:
SELECT post.*FROM postINNER JOIN post_tag ON post.id = post_tag.post_idWHERE post.status = 1 AND post_tag.tag_id = 123ORDER BY post.created DESCLIMIT 100
Note: Because pos
Tags: LAN 16px boost share scan show PNG pointer engineText inside June found that few people can complete the understanding of the MySQL join type and algorithm, the online spread to improve the performance of the join, increase the number of join_buffer_size fallacy is everywhere. Of course, there are some ignorant P
|+----+-------------+------------+-------+-----------------+------------+---------+--------+------+------------- -----------------+Efficiency of execution similar to not inThe basic principle of database optimization: To make the Cartesian product occur between the smallest possible set, MySQL can be scanned directly through the index when the join, and embedded in the
database, and even the VARCHAR type is redundant, because CHAR (6) can well complete the task. Similarly, if possible, we should use MEDIUMINT instead of BIGIN to define integer fields.
Another way to improve efficiency is to set the field to not null whenever possible, so that the database does NOT need to compare NULL values during future queries.
Some text fields, such as "province" or "gender", can be defined as ENUM. In MySQL, the ENUM type is p
Label:Summary : In this tutorial, you'll learn how to use the MySQL INNER JOIN clause to select data from multiple table s based on join conditions.Introducing MySQL INNER JOIN clauseThe MySQL INNER
The difference between Mycat and SHARDING-JDBC
1) Mycat is a third-party application of middleware, SHARDING-JDBC is a jar package
2) You do not need to change the code when using Mycat, and you need to modify the code when using SHARDING-JDBC
Mycat (proxy middleware layer ):
SHARDING-JDBC (Tddl for the application layer represented ):
Second, Mycat Shard join
In the previous article MySQL series four: Dat
I have mentioned on the Internet that multi-table join queries have very low performance and try to avoid join operations. I also encountered this big problem in the project. some reports need several tables for join queries to get data, however, too much data in the table will increase the query time. I tried to repla
Tags: Usage resize procedure table operation ble SQL injection L database support Address of this article Share an outline: 1. Optimize your query for query caching
2. EXPLAIN your SELECT query
3. Use LIMIT 1 4 for a single row of data.
Jianjian index 5 for the search word
. In the join table, use a fairly type of example and index it
6. Never ORDER by RAND ()
7. Avoid SELECT *
8. Always set an ID of 9 for each table
. Use ENUM instead of V
, $,166,277,361,438,499,506,509,605,635,749,832,939,970,980);Unfortunately, the opposite is true. MySQL wants to use external association conditions to quickly filter subqueries, which may be consideredThis makes the subquery more efficient. MySQL will rewrite the query like this:SELECT * from Sakila.film WHERE EXISTS (SELECT*fromWHERE=1and= film.film_id);In thi
As we all know, Mysql paging requires the use of Limit for paging. When the data size is small, the Limit performance can be imagined. For example: {code...} the preceding SQL statement has no performance problems. However, if the offset is too low, a performance bottleneck may occur. For example, {code... as we all kn
scanning the master table multiple times in the program. It also greatly reduces the blocking of the "Update lock" in program execution and reduces blocking, improves concurrency performance. Avoid using in and not in as much as possible, which will cause the database engine to discard the index for full table scanning. If you try to avoid using or, the database engine will discard the index for full table scanning. Try to avoid null value determinat
As we all know, MySQL paging is to use limit for paging, the amount of data/number of pages small when the limit performance is conceivable. Such as:
SELECT pid,author,hash,dateline FROM posts WHERE pid='123456' ORDER BY pid ASC LIMIT 100,100;
There is no problem with the SQL statement performance described above.
However, p
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.