"MySQL" index Type normal, unique, fulltext

Source: Internet
Author: User
Tags mysql index
Provides various official and user-released code examples. For code reference, you are welcome to learn about the "MySQL" index Type normal, unique, full text.
Question 1: What are the differences between mysql index types normal, unique, and full text?

Normal: indicates a normal index.

Unique: unique, and duplicate indexes are not allowed. If the field information is not repeated, for example, when the ID card number is used as an index, you can set it to unique.

Full textl: full-text search index. When FULLTEXT is used to search for a long article, it works best. It is used in short text. If there are only one or two lines of text, the normal INDEX is also acceptable.

In summary, the index category is determined by the content characteristics of the index field. Normally, normal is the most common.





Question 2: Which fields in the table should be selected as indexes during actual operations?

To make indexes more efficient, you must consider which fields to create indexes and what types of indexes to create when creating indexes. There are seven principles:

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

AD: truly free, domain name + VM + enterprise mailbox = 0 RMB

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.