MySQL->索引的维护[20180504]
2018-06-18 01:24:22来源:未知 阅读 ()
mysql> create table index_tab03( -> id int, -> col01 varchar(20), -> index index_01(col01) -> )engine=InnoDB default charset=utf8; Query OK, 0 rows affected (0.01 sec) mysql> desc index_tab03; +-------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+-------+ | id | int(11) | YES | | NULL | | | col01 | varchar(20) | YES | MUL | NULL | | +-------+-------------+------+-----+---------+-------+ 2 rows in set (0.00 sec) mysql> show index from index_tab03\G *************************** 1. row *************************** Table: index_tab03 Non_unique: 1 Key_name: index_01 Seq_in_index: 1 Column_name: col01 Collation: A Cardinality: 0 Sub_part: NULL Packed: NULL Null: YES Index_type: BTREE Comment: 1 row in set (0.00 sec) m
mysql> alter table index_tab01 add primary key(id,col01);
Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> alter table index_tab01 add index indx_01(col01);
Query OK, 0 rows affected (0.00 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> alter table index_tab01 add fulltext indx_02(col01,col02(300));
ERROR 1214 (HY000): The used table type doesn't support FULLTEXT indexes
mysql> alter table index_tab01 engine=MyISAM;
Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> alter table index_tab01 add fulltext index_02(col01,col02(30));
Query OK, 0 rows affected (0.00 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> show index from index_tab01\G
*************************** 1. row ***************************
Table: index_tab01
Non_unique: 0
Key_name: PRIMARY
Seq_in_index: 1
Column_name: id
Collation: A
Cardinality: NULL
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
*************************** 2. row ***************************
Table: index_tab01
Non_unique: 0
Key_name: PRIMARY
Seq_in_index: 2
Column_name: col01
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
*************************** 3. row ***************************
Table: index_tab01
Non_unique: 0
Key_name: index_un
Seq_in_index: 1
Column_name: col01
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
*************************** 4. row ***************************
Table: index_tab01
Non_unique: 1
Key_name: indx_01
Seq_in_index: 1
Column_name: col01
Collation: A
Cardinality: NULL
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
*************************** 5. row ***************************
Table: index_tab01
Non_unique: 1
Key_name: index_02
Seq_in_index: 1
Column_name: col01
Collation: NULL
Cardinality: NULL
Sub_part: NULL
Packed: NULL
Null:
Index_type: FULLTEXT
Comment:
*************************** 6. row ***************************
Table: index_tab01
Non_unique: 1
Key_name: index_02
Seq_in_index: 2
Column_name: col02
Collation: NULL
Cardinality: NULL
Sub_part: NULL
Packed: NULL
Null: YES
Index_type: FULLTEXT
Comment:
6 rows in set (0.00 sec)
mysql> alter table index_tab01 drop primary key;
Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> alter table index_tab01 drop index index_02;
Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> drop index index_01 on index_tab01;
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
下一篇:MySQL数据查询(重点)
- MySQL索引详解与索引的优化 2019-08-23
- 这里主要讲解一下Git撤销&回滚操作 2019-08-23
- mysql 多列索引的生效规则 2019-08-09
- mysql日志信息查看与设置mysql-bin 2019-07-24
- Mysql-MariaDB设置延迟同步 2019-07-24
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash