Home > Database > Mysql Tutorial > What is a MySQL index? 【Detailed explanation】

What is a MySQL index? 【Detailed explanation】

藏色散人
Release: 2018-09-05 17:10:34
Original
1701 people have browsed it

This article mainly introduces to you what is a MySQL index?

The establishment of MySQL index is very important for the efficient operation of MySQL. The index can greatly improve the retrieval speed of MySQL.

For example, if MySQL that is properly designed and uses indexes is a Lamborghini, then MySQL that is not designed and uses indexes is a human tricycle.

Indexes are divided into single column indexes and combined indexes. A single-column index means that an index only contains a single column. A table can have multiple single-column indexes, but this is not a combined index. Combined index, that is, an index contains multiple columns.

When creating an index, you need to ensure that the index is a condition applied to the SQL query statement (usually as a condition of the WHERE clause). [For specific operation methods, you can refer to MySQL Video Tutorial or MySQL Manual on the PHP Chinese website! 】

In fact, the index is also a table, which saves the primary key and index fields and points to the records of the entity table.

The above all talk about the benefits of using indexes, but excessive use of indexes will cause abuse. Therefore, the index will also have its shortcomings: although the index greatly improves the query speed, it will also reduce the speed of updating the table, such as INSERT, UPDATE and DELETE on the table. Because when updating the table, MySQL not only needs to save the data, but also save the index file.

Creating index files will occupy disk space.

The above is the detailed content of What is a MySQL index? 【Detailed explanation】. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template