MySQL enforces indexes and disables an index

Source: Internet
Author: User

MySQL enforces indexes and disables an index

1, MySQL mandatory use index: Force index (index name or primary key PRI)

For example:

SELECT * FROM Table Force index (PRI) limit 2; (use primary key)

SELECT * FROM Table Force index (ZIDUAN1_INDEX) limit 2; (Enforce use of index "Ziduan1_index")

SELECT * FROM Table Force index (PRI,ZIDUAN1_INDEX) limit 2; (Forced use of index "PRI and Ziduan1_index")

2. MySQL prohibits an index: Ignore index (indexed name or primary key PRI)

For example:

SELECT * FROM table Ignore index (PRI) limit 2 (no primary key)

SELECT * FROM table Ignore index (ZIDUAN1_INDEX) limit 2; (Prohibit use of index "Ziduan1_index")

SELECT * FROM table Ignore index (PRI,ZIDUAN1_INDEX) limit 2; (Prohibit use of index "Pri,ziduan1_index")

MySQL enforces indexes and disables an index

Related Article

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.