In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly talks about "MYSQL5.6 5.7dealing with the problem of uneven distribution of data". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "MYSQL5.6 5.7 deals with the problem analysis of uneven data distribution".
To deal with the uneven distribution of data, the orace database uses additional statistical histograms, while MYSQL
If there is only one statistical data such as the different values of the index, then we produce the following data:
Mysql > select * from test.testf
+-+ +
| | id | name |
+-+ +
| | 1 | gaopeng |
| | 2 | gaopeng1 |
| | 3 | gaopeng1 |
| | 4 | gaopeng1 |
| | 5 | gaopeng1 |
| | 6 | gaopeng1 |
| | 7 | gaopeng1 |
| | 8 | gaopeng1 |
| | 9 | gaopeng1 |
| | 10 | gaopeng1 |
+-+ +
10 rows in set (0.00 sec)
There is a normal secondary index on name
Mysql > analyze table test.testf
+-+
| | Table | Op | Msg_type | Msg_text | |
+-+
| | test.testf | analyze | status | OK | |
+-+
1 row in set (0.21 sec)
The following implementation plans are made respectively:
Mysql > explain select * from test.testf where name='gaopeng'
+-- +
| | id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+-- +
| | 1 | SIMPLE | testf | NULL | ref | name | name | 63 | const | 1 | 100.00 | NULL |
+-- +
1 row in set, 1 warning (0.00 sec)
Mysql > explain select * from test.testf where name='gaopeng1'
+-- +
| | id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+-- +
| | 1 | SIMPLE | testf | NULL | ALL | name | NULL | NULL | NULL | 10 | 90.00 | Using where |
+-- +
1 row in set, 1 warning (0.00 sec)
You can see that the execution plan is correct, only one row of name='gaopeng' selects the index, and 9 of name='gaopeng1' walks the entire table.
In theory, if you only record different statements, then the choice of these two statements is 1 / 2, which should result in an error in the execution plan, while in MYSQL 5.65.7
They all made the right choice, so why?
Actually, the reason lies in the parameter eq_range_index_dive_limit. Let's take a look at trace.
Opt 2: | opt: (null): "gaopeng1
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.