MySql Index Index advantages 1. You can ensure the uniqueness of the data by creating a unique index or primary key index. Index Disadvantages 1. Creating and maintaining indexes takes time, which increases with the amount of data. (Creating an index will take up disk space for the index file. Generally this problem is not too serious, but if you create multiple combined indexes on a large table, the index file will expand quickly). Things to note when using indexes 1. Speed up indexing on columns that are frequently searched 6. If you create an index for the nickname field in the like statement, the index will not work when the query statement is nickname lick '%ABC%'. However, the index will work if the query statement is nickname lick 'ABC%'. 7. The index will not include NULL columns. If a column contains NULL values, it will not be included in the index. If a column in a composite index contains NULL values, the composite index will be invalid. Generally, a default value of 0 or ' ' string is required. 8. Use short indexes. If one of your fields is Char(32) or int(32), specify a prefix length when creating the index, such as the first 10 characters (assuming that most values are unique). Then short indexes can increase query speed, save disk space, and reduce I/O operations. 9. Do not perform operations on columns, as this will invalidate the MySQL index and perform a full table scan 10. Choose the smaller the data type, the better, because usually the smaller the data type, the smaller the space occupied in the disk, memory, CPU, cache, and the faster the processing. When not to create an index 1. Columns that are rarely used in queries should not be indexed. If indexes are created, however, MySQL performance will be reduced and space requirements will increase. The above is the detailed analysis of MySql index usage strategy. For more information about MySQL index, please pay attention to other related articles on 123WORDPRESS.COM! You may also be interested in:
|
<<: Docker data volume common operation code examples
>>: JavaScript to achieve a simple magnifying glass effect
CocosCreator version: 2.4.2 Practical project app...
Table of contents Step 1: Installation Step 2: Ci...
Due to the default bridge network, the IP address...
Problem description: I bought a Mac and installed...
It's embarrassing to say that I had to search ...
Preface The concept of dark mode originated from ...
Next, I will install Java+Tomcat on Centos7. Ther...
I recently installed Ubuntu 20.04 and found that ...
Join uses the Nested-Loop Join algorithm. There a...
How can I hide the scrollbars while still being a...
I just want to make a small thing that combines w...
Table of contents Preface: Step 1: Find the free ...
In the XHTML language, we all know that the ul ta...
front end css3,filter can not only achieve the gr...
grammar background: linear-gradient(direction,col...