To improve user queries, you can use the MySQL index method. The following describes how to use MySQL indexes properly. If you are interested in using MySQL indexes, take a look.
Rational use of MySQL indexes:
MySQL index is an important data structure in the database. Its fundamental goal is to improve the query efficiency. Currently, most database products adopt the ISAM index structure first proposed by IBM. The index should be used properly. The usage principles are as follows:
● The optimizer automatically generates an index for fields that are frequently connected but not specified as foreign keys.
● Index the columns that are frequently sorted or grouped (that is, group by or order by operations.
● Create a search for columns with different values that are frequently used in conditional expressions. Do not create an index for columns with fewer values. For example, in the "gender" column of the employee table, there are only two different values: "male" and "female", so there is no need to create an index. If an index is created, the query efficiency is not improved, but the update speed is greatly reduced.
● If there are multiple columns to be sorted, you can create a compound index on these columns ).
● Use system tools. For example, the Informix database has a tbcheck tool that can be checked on suspicious indexes. On some database servers, the index may be invalid or the reading efficiency may be reduced due to frequent operations. If an index-based Query slows down, you can use the tbcheck tool to check the index integrity, fix the issue if necessary. In addition, when a database table updates a large amount of data, deleting and re-indexing can increase the query speed.
Five common MySQL Log types
Automatic Restoration of MySQL Log Files
Tips for compressing MySQL Data Files
MySQL database table Representation
Three methods for restoring MySQL Data Files