current position:Home>MySQL Optimization: Performance Analysis of like and = in where, Java Architect growth express updated to
MySQL Optimization: Performance Analysis of like and = in where, Java Architect growth express updated to
2022-02-04 16:47:54 【mb61ab44019023e】
========================================================================
First , Let's introduce it mysql Medium explain keyword ;explain It means to carry out the plan , That is, view this message through this command sql How is it implemented .
It's easy to use , namely explain + sql sentence , for example :
explain select * from info where id like '12345';
Specifically for explain The introduction of keywords will be summarized in my blog in the future , At present, I don't know that small partners can baidu on their own ...
Let's use it explain Test it like and = Query under , First, let's test the fields that are indexed :
EXPLAIN SELECT
- FROM
crms_customer WHERE
id = '7cf79d7c8a3a4f94b5373b3ec392e32d';
And now we put "=" Switch to like Have a try :
EXPLAIN SELECT
- FROM
crms_customer WHERE
id LIKE '7cf79d7c8a3a4f94b5373b3ec392e32d';
Through comparison, you can see two returned results type Fields and Extra The data in the field is different , Then why is it different , What do they mean ?
[]( )type Field :
===========================================================================
type Field is an optional value , The performance of these values from low to high is sorted as follows :
It is obvious from the table that , among const Is a constant lookup , and RANGE Is to search the range of index columns , So the performance is obviously reflected .
That use like When inquiring ,Extra What does the field represent ?Extra In the field Using where, What does it stand for ?
[]( )Extra Field
=======================================================================
1,Extra The fields are Explain Also important columns in the output , Represents MySQL Important supplementary information to query plan during query optimizer execution .
2,Extra In the field Using where signify mysql The server will filter the rows after the storage engine retrieves them . So instead of using ’=' Another step in the search process .
Obviously, from the above summary, we can draw a conclusion : When we use index fields for conditional queries ,’=' It's better than like fast .
Do you think it's over here ?
But there is no
Some friends should ask about the non indexed fields ?
Right , Let's continue to test non indexed fields
EXPLAIN SELECT
- FROM
crms_customer WHERE
customer_name = ' Zhang Fei ';
summary
Internet companies like the characteristics of talent : Passion for Technology , Strong technical foundation strength ; Take the initiative , Good at teamwork , Good at summarizing and thinking . No matter which company , They attach great importance to high concurrency and high availability technology , Pay attention to the foundation , So don't underestimate any knowledge . Interview is a two-way choice process , Don't be afraid to interview , Not conducive to their own play . At the same time, we should not only focus on salary , It depends on whether you really like the company , Can I really get exercise . Actually I wrote so much , It's just my own summary , Not necessarily for everyone , I believe after some interviews , Everyone will have these feelings .
In addition, I also sorted and collected 2021 More than one company interview knowledge and a variety of technical points collated
Here are some screenshots, hoping to help you .
This article has been CODING Open source project :【 A big factory Java Analysis of interview questions + Core summary learning notes + The latest explanation video + Actual project source code 】 Included
copyright notice
author[mb61ab44019023e],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/02/202202041647533901.html
The sidebar is recommended
- How does uniapp enable wechat applet users to automatically register and log in without authorization
- Java springboot queries the database. The result in the database is empty. Will it return null or throw an exception directly at this time
- Vue import excel table, interface error
- Why is no target connected always displayed
- The sum of the first n series can be solved by a lucky person
- How to calculate the time complexity
- Why does Java report an error?
- Regular expressions that allow numbers, English, and some special characters
- Please answer the questions about # C #!
- Is there a method to realize or call sending SMS
guess what you like
-
The most hardcore Java programmers in the whole network must have basic knowledge (I)
-
How to use selenium to solve the problem of continuing reading in a library
-
In simple terms, MySQL index optimization topic sharing | interview cycle
-
How to convert the specific template type of template function into string in C + +
-
Why is the result 3 4
-
DDD (Domain Driven Design) thought interpretation and excellent practice GGG
-
MFC project operation error is not a class or namespace
-
Builder pattern of Java design pattern
-
How to change the inconsistency of two Y-axis axes of echarts? The values of the left and right Y axes are uncertain
-
C language to find the volume and surface area of the ball, the volume is equal to the surface area?
Random recommended
- Analysis of shallow cloning and deep cloning in Java
- main. JS introduces Ant Design Vue
- Can some Java dictionaries store null?
- I need HTML when downloading the boost library with WGet on CentOS tar
- [test development] knowledge points - spring cache + redis is used to cache data in the project
- VO entity deposit value is empty? VO entity content data is empty
- Logic of process scheduling in Linux kernel source code analysis
- How to open a file with relative path in C + + under QT environment
- 30000 words to talk about redis (VI)
- It's great to use debug a!
- Netcom infinite integral code
- How to find element label in MATLAB
- 2021 is gone, and 2022 is my year-end summary of 2021
- How to use wechat applet for this page
- Why is the second% s not output
- Badboy recording script website can't be opened in ie. why can't badboy record after changing the default browser?
- fatal error LNK1113: invalid machine type
- Crazy God said that there was a 404 problem in the ssmbuild project in Java
- What is the spark job submission process?
- How about the performance comparison of query acceleration in maxcompute?
- What is a database connection pool?
- What is the workflow of spark streaming and how is it different from storm?
- What is the application scenario of streaming data writing in maxcompute?
- What are the source databases supported by DTS self built Mysql to synchronize to RDS MySQL?
- What is the process of establishing a connection between an application and a database?
- What are the target databases supported by DTS self built Mysql to synchronize to RDS MySQL?
- What are the differences and connections between the ML and mllib packages of spark?
- What are the benefits of database connection pooling?
- What are the application scenarios of query acceleration in maxcompute?
- What are the prerequisites for DTS self built Mysql to synchronize to RDS MySQL?
- How does MySQL query statements?
- What are the similarities and differences between yarn cluster and yarn client?
- What are the restrictions on the source database of DTS self built MySQL synchronized to RDS MySQL?
- What is the difference between map and mappartitions?
- What database server performance analysis methods and commands does MySQL have?
- What are the other limitations of DTS self built MySQL synchronization to RDS MySQL?
- What is the difference between MySQL blob and text?
- What is the description of the special case of DTS self built MySQL synchronizing to RDS MySQL?
- What types of locks are there in MySQL?
- DTS self built MySQL synchronizes to RDS. What synchronization architectures does MySQL support?