Home >Database >Mysql Tutorial >The difference between mysql index types normal, unique, and full text

The difference between mysql index types normal, unique, and full text

巴扎黑
巴扎黑Original
2017-06-23 13:57:091841browse

normal: represents a normal index

unique: represents a unique index that does not allow duplicates. If the field information is guaranteed not to be repeated, for example, when the ID number is used as an index, it can be set to unique

full textl: Represents the index of full-text search. FULLTEXT works best when searching for a long article. Used for relatively short text, if it is only one or two lines, ordinary INDEX can also be used.

Summary, the type of index is determined by the content characteristics of the indexed field, and normal is usually the most common.

In the actual operation process, which fields in the table should be selected as indexes?

In order to make the use of indexes more efficient, when creating an index, you must consider which fields to create the index on and what type of index to create. There are 7 major principles:

1 . Select unique index
2. Create indexes for fields that often require sorting, grouping and union operations
3. Create indexes for fields that are often used as query conditions
4. Limit the number of indexes
5. Try to use an index with a small amount of data
6. Try to use prefixes to index
7. Delete indexes that are no longer used or rarely used

The above is the detailed content of The difference between mysql index types normal, unique, and full text. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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