Joint IndexThe definition of the joint index in this article is (MySQL): ALTER TABLE `table_name` ADD INDEX (`col1`,`col2`,`col3`); Advantages of joint indexesIf there is more than one SQL statement, two conditions are required. SELECT * FROM `user_info` WHERE username='XX',password='XXXXXX'; When the index is searching the The size of a matching index is smaller than that of a single index, and it is just an index tree, which saves more time and space complexity than a single column index. The essence of joint index hits (understanding of the leftmost match)definition When creating a ( DiagramPopular understanding A joint index is like a phone book organized by -- Only hit col1, col2 SELECT * FROM `table_name` WHERE `col1`='XX'; -- hit col1, col2. The order of col1 and col2 can be reversed SELECT * FROM `table_name` WHERE `clo1`='XX',`clo2`='XXX'; SELECT * FROM `table_name` WHERE `clo2`='XXX', `clo1`='XX'; -- hit col1,col2,col3. Similarly, the order of the three columns can be reversed. SELECT * FROM `table_name` WHERE `col1`='X',`col2`='XX',`col3`='XXX'; SELECT * FROM `table_name` WHERE `col1`='X',`col3`='XX',`col2`='XXX'; SELECT * FROM `table_name` WHERE `col2`='X',`col3`='XX',`col1`='XXX'; This is the end of this article about the implementation of MySQL joint index (compound index). For more relevant MySQL joint index content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: HTML tag ID can be a variable
>>: Operations of communication between Docker containers and external network communication
Ansible is a new automated operation and maintena...
Note: The nginx version must be 1.9 or above. Whe...
When you log in to MySQL remotely, the account yo...
Table of contents 1. Array deduplication 2. Dedup...
In desperation, I suddenly thought, how is the Sin...
One environment Install VMware Tools on CentOS 7 ...
Table of contents Preface What is VueUse Easy to ...
MySQL DECIMAL data type is used to store exact nu...
In the process of making web pages, we often use f...
The img tag in XHTML should be written like this:...
What is WSL Quoting a passage from Baidu Encyclop...
Preface: In project development, some business ta...
1. Introduction Why do we need indexes? In genera...
Copy table structure and its data The following s...
The most important thing for idea to package a we...