Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Explain Analyze in MySQL version 8.0.18

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

In previous versions, we used the explain command to see the specific execution plan of SQL. A new explain extension has been added to MySQL 8.0.18, one is explain format=tree and the other is Explain Analyze based on the explain format=tree extension. Today we'll see how this command is executed.

Or use the sbtest1 table for testing.

Explain analyze select count (*) from sbtest1

This result is very strange, without where conditions, nothing can be shown, it seems to be a BUG?

OK, add a where id > 0 and try again.

Explain analyze select count (*) from sbtest1 where id > 0

Notice the red underlined section, which internally runs the query and measures the execution time.

Meaning explanation:

1) the rows=4936262 in the cost section is consistent with the result generated by explain, and both estimate the number of rows read.

2) the rows=10000000 in the actual section is the real result returned by executing this SQL, as shown in the following figure

3) actual time=62004.565 (in ms milliseconds), converted into seconds, the execution time of this SQL is 62 seconds, but there is actually a big error, you see above

The execution time is 7.98 seconds, which is rounded to 8 seconds, and the error of 62ap8 is about 77%, so we can't really believe these numbers.

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report