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

What are the audits of mysql select?

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article mainly introduces "what is the audit of mysql select". In the daily operation, I believe that many people have doubts about the audit of mysql select. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubts about "what is the audit of mysql select?" Next, please follow the editor to study!

Prohibit the use of select * and get only the necessary fields

Interpretation:

(1) select * increases the memory / bandwidth consumption of cpu/io/

(2) the specified field can be covered by the index effectively.

(3) the specified field query can guarantee no impact on the application when the table structure is changed.

Insert must specify a field to prohibit the use of insert into T values ()

Interpretation: specify field insertion to ensure that there is no impact on the application when the table structure changes

Implicit type conversion invalidates the index, resulting in a full table scan

Prohibit the use of functions or expressions in where conditional columns

Interpretation: resulting in missed index, full table scan

Prohibit negative queries and fuzzy queries starting with%

Interpretation: resulting in missed index, full table scan

Take the 50,000 data as the tipping point. If you do not use like if it exceeds 50,000, you must modify it.

Disable large table JOIN and avoid subqueries as much as possible

OR on the same field must be rewritten. The value of IN,IN must be less than 50.

The application must catch SQL exceptions

Interpretation: convenient positioning of online problems

Viewing the execution plan shows that the subquery will have one more step than the table association under the same conditions.

A temporary table will be generated at the same time.

The efficiency of associative query is better than that of subquery.

Mysql associated table queries after 5.6can use in but exist is prohibited

The execution mode of In has been optimized in version 5.6 and later.

Exist is still implemented in the old way. Forbidden to use

At this point, the study of "what is the audit of mysql select" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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