MySQL indexing is important for the efficient operation of MySQL, and indexing can greatly improve the retrieval speed of MySQL.
For example, if the reasonable design and use of the indexed MySQL is a Lamborghini, then no design and use of the index of MySQL is a human tricycle.
Index sub-column indexes and composite indexes. A single-column index, that is, an index contains only single columns, and a table can have multiple single-row indexes, but this is not a composite index. A composite index, that is, an index that contains multiple columns.
When you create an index, you need to make sure that the index is the condition that is applied to the SQL query statement (generally as the condition of the WHERE clause). "How to do this you can refer to the MySQL video tutorial or mysql manual in topic.alibabacloud.com!" 】
In fact, the index is also a table that holds the primary key and index fields and points to the records of the entity table.
The benefits of using indexes are described above, but excessive use of indexes will result in abuse. Therefore, the index also has its drawbacks: Although the index greatly improves query speed, it also slows down the updating of tables, such as INSERT, UPDATE, and delete on tables. Because when updating a table, MySQL not only saves the data, but also saves the index file.
Index files that create indexes that consume disk space.