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

The solution of Mysql Index failure

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Editor to share with you the solution to the failure of the Mysql index, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Background

A full query appeared in the data table with 60 million data, and the sql statement found that the query did not go through the index but the whole table to find out the cause of index failure.

The # sql statement EXPLAIN SELECT count (*) FROM order_recipient_extend_tab WHERE start_date > '1628442000' and start_date=, adds the corresponding condition to Index First Key and continues to read the next field of the index; if it exists and the condition is >, the corresponding condition is added to Index First Key, and then the extraction of Index First Key is terminated; if it does not exist, the extraction of Index First Key is also terminated.

Index Last Key

In contrast to Index First Key, the extraction rule: start with the first field of the index and check whether it exists in the where condition. If it exists and the condition is =, '1628442000 and the index Last Key is: start_date=, >,

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