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
The fixed IP address of the centos-DVD1 version s...
I remember when I was interviewing for my current...
MySql Download 1. Open the official website and f...
background Search the keyword .htaccess cache in ...
Docker-compose deploys gitlab 1. Install Docker I...
This article uses an example to describe how to c...
Using the CSS3 border-image property, you can set...
Since its release in 2013, Docker has been widely...
After the green version of mysql5.6 is decompress...
External Access Randomly map ports Using the -P f...
Why is it that when the input tag type is file an...
A process is a program code that runs in the CPU ...
There has been a lot of discussion about H1 recent...
Overview When a 500 or 502 error occurs during ac...
1. The first method is to use the unhup command d...