Mysql index -- (mysql 2) _ MySQL

Source: Internet
Author: User
Tags mysql index
Mysql index -- (mysql 2) bitsCN.com

Mysql index -- (mysql 2)

Index type:

Normal index

Primary key

Foreign key

Unique index

Non-unique

Professional index:

-- B-tree balanced number index, which is different from binary tree. the height of a binary tree may be very high. The Balance tree may not be very high.

B + tree B-tree is the logical name, and B + tree is the technical implementation. some of them are stored on disks when the memory is insufficient (innodb, MyISAM, Memery, etc)

R-tree spatial index (MyISAM)

Full text index. (MyISAM)

Hash index (Memery)

Purpose:

Reducing I/O will provide query speed and affect dml speed.

Optional: percentage of returned rows to the entire record

Index type: prefix index, composite index, function index flexibility (implemented by adding columns and triggers), full-text index

Composite index: oracle has an index skip algorithm to enable the index of a non-bootstrap column to be used. mysql must use composite index in the defined order.

Full-text index: mainly used to query words .... where match (column) aginst ('characters' in mode ). there are 3 medium-mode boolean (operator expressions supported), natural language, and extended natural language.

Select title from books where mathc (title) against ('Prince ')

Select title, author from books where match (title) against ('green + Anne 'in boolean mode); -- in natural language mode/with query expansion

-- View the execution plan

Explain select * from t where year (d)> 1994/G

Select_type: subquery (use subquery), dependent subquery (associate subquery), derived (use subquery as from, embedded view ),

Simple (simple query)

Union (union is used)

View the index of a table:

Show index from [tb_name]/G

BitsCN.com

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.