In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article is to share with you about the example analysis of MYSQL 5.7 VS 8 using functions, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article, without saying much, follow the editor to have a look.
Back to today's topic, MYSQL uses functions, hehe, functions are useful everywhere, think twice and fart, I use good, is not your own written function is too bad, just let others think twice.
OK, let's look at the next experiment.
1 MYSQL 5.7Why do you set up such a table, because everyone likes to hear the name?
There is nothing unusual at this time, and the "water monster" begins to appear in the following picture.
Why, everything else is fine. The time for the third query is 5 seconds.
Is it true that MYSQL 8 does not have such a problem?
When it comes to MYSQL 8.015, there is still a problem.
Up to now, what is the problem and what is the matter?
Similarly, an ordinary table cannot be queried, but the fields have changed, and the query time takes 5 seconds and less than 1 second.
Let's get this straight. What's the difference here?
1 watch time is very common, there is no problem
2 some fields are indexed and some fields are not added
The one with slow query is not indexed.
4 there are 5 pieces of overall data
5 when the function SLEEP is not used, the query speed is the same
5 queries include GROUP BY and LIMIT
So what's the key difference? function 1, index 2.
But the problem is that you can't guarantee that the column of the query that you use the function must have an index, right?
Well, since this is the case, let's go a little deeper. Why is this happening? why on earth is this possible? More unfortunately, I checked the slow query statement, and there was no statement that exceeded the record rule I set for 1 second to be recorded.
This reminds me of, do not take the initiative, do not refuse, irresponsible, these three sentences, ah.
Just imagine that there are five pieces of data in this table. If there are 5 million rows, hehe, I don't know where the crying is.
What exactly is the problem? the following diagram has already explained part of the reason. I think you already understand, so the function of MYSQL should be careful, think twice and think twice when applying it.
The above is the example analysis of MYSQL 5.7VS 8 using functions. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
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.