Pay attention to the following points when creating a MYSQL index: the time to create an index is costly for you to enable the index cache when you like multiple conditions, if you are interested, you can refer to this article, which may help you
Pay attention to the following points when creating a MYSQL index: the time when the index is created/For like/For/enabling the index cache with multiple conditions/indexing, etc, if you are interested, you can refer to this article, which may help you
1. index creation time: it is worthwhile to create an index for a field in select, filter, and sort conditions.
2. For Fuzzy queries like '% XXX', normal indexes cannot be satisfied, and full-text indexes must be created.
3. if there are multiple conditions, such :"... where a = xxx and B = yyy ","... where a = xxx order by B ","... where a = xxx group by B ". A composite index is required. However, the composite index can only be used when the SQL statement meets the "leftmost prefix. In addition, composite indexes have some side effects. For example, the index size may be larger than the data because the composite indexes have many composite entries. Therefore, in practical applications, we need to customize it and use the slow query analysis tool for analysis.
4. Enable the index cache to directly search for indexes in the memory and no more disks are needed.
5. index creation is costly. When the update and delete statements are executed, the index update will take more time. You can use the mysqlreport to understand the percentage of select, update, delete, insert, and replace statements.