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

How to write the SQL statement of mysql without index

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly explains "how to write SQL statements without index in mysql". The explanation in this article is simple and clear, easy to learn and understand. Please follow the idea of Xiaobian and go deep into it slowly to study and learn "how to write SQL statements without index in mysql" together.

1. Index columns participate in expression calculation.

SELECT 'sname' FROM 'stu' WHERE 'age' + 10 = 30;

2. Function operation.

SELECT 'sname' FROM 'stu' WHERE LEFT('date',4) < 1990;

3. % Word %-Fuzzy Query.

SELECT * FROM 'manong' WHERE `uname` LIKE ' %%' --Go index SELECT * FROM 'manong' WHERE `uname` LIKE '%%' --Go index

4. Compare strings with numbers.

CREATE TABLE 'a'('a ' char(10));EXPLAIN SELECT * FROM 'a' WHERE 'a'="1" --go index EXPLAIN SELECT * FROM 'a' WHERE 'a'=1 --go index, also use function operation

5. There is or in the query condition.

Even if there is a conditional index, it will not be used. In other words, all fields required to be used must be indexed:

select * from dept where dname='xxx' or loc='xx' or deptno = 45;

Regular expressions do not use indexes.

The optimizer estimates that it is faster to use a full table scan than to use an index instead of an index.

MySQL internal optimizer optimizes SQL statements.

Thank you for reading, the above is "mysql does not go index SQL statement how to write" the content, after the study of this article, I believe we do not go index mysql SQL statement how to write this problem has a deeper understanding, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

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

Internet Technology

Wechat

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

12
Report