Database tuning Tutorial (vi) related operations for indexes

Source: Internet
Author: User

Third, index


3. Related operations of the index

We talked about the role and type of the index, and we talked about the index of the relevant operation!

1) Add index

We've got some introductions here, so here's a summary.

Add primary key Index

CREATE TABLE AAA (ID int unsigned primary key auto_increment, name varchar (+) NOT null Defaul "); ALTER TABLE name add Prima Ry key (column name);

Add a normal index

Create index index name on table (column name 1, column name 2);

Add a unique index

CREATE TABLE DDD (ID int primary key auto_increment, name varchar () unique); Create unique index index name on  table name (list:);

To add a full-text index

CREATE TABLE articles (       ID INT UNSIGNED auto_increment not NULL PRIMARY KEY,       title VARCHAR (+),       body Text,
   fulltext (title,body)     ) Engine=myisam charset UTF8; ALTER TABLE Articles ADD fulltext (title,body);

2) Query Index

Show index from Emp\g


3) Delete Index

Drop index name on table name;

4) Modify the index

Delete First, then create



At the end of this lecture, we will talk about the price of the index.





Database tuning Tutorial (vi) related operations for indexes

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.