In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces why the rows returned in EXPLAIN and SHOW TABLE STATUS LIKE is not accurate. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.
"Why isn't the rows returned in SHOW TABLE STATUS LIKE accurate?" Today, I will take a moment to talk about it briefly!
First of all, let's take a literal view of the number of lines represented by rows. The exact number of rows affected, or the number of rows scanned!
In theory, my actual query on the number of rows scanned should be accurate. But the display here is not accurate, MySQL statistics are not accurate, is MySQL deliberately designed like this? If so, then why is it designed this way?
Obviously, MySQL knows about the inaccuracy. Then it must be designed for a reason.
As we all know, MySQL has an optimizer that makes some optimizations to your SQL. The principle of the optimizer is to estimate the cost of some of each execution strategy before actually implementing the SQL and choose what it thinks is the best solution to implement!
Because the optimizer makes a judgment before it is actually executed, it cannot be accurate. The optimizer can only count and estimate the number of rows to be scanned according to the "differentiation" of the index.
Here, MySQL is in order to manipulate the data more efficiently. Using the knowledge of mathematics, a sampling statistics is made.
Sampling, that is, InnoDB will select N data pages by default, count the different values on these pages, get an average, and then multiply by the number of pages of the index to get the cardinality of the index.
The above explains why the rows returned in EXPLAIN and SHOW TABLE STATUS LIKE is not accurate!
About why the rows returned in EXPLAIN and SHOW TABLE STATUS LIKE is not accurate to share here, I hope the above content can be of some help to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
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.