当前位置:网站首页>MySQL add and delete indexes
MySQL add and delete indexes
2022-07-28 15:47:00 【Grapefruit 521】
Index type : General index , unique index , Full-text index , Spatial index
1、 General index
NORMAL: This is the most basic index , It has no restrictions , For example, the above is title The index created by a field is a normal index ,MyIASM In the default BTREE Index of type , It's also the index we use most of the time .
1、 Create index
CREATE INDEX indexName ON runoob_tbl (runoob_title);
2、 Modify table structure ( Add index )
See table details
desc runoob_tbl;

runoob_tbl: The name of the table
INDEX: Normal index type
indexName: The index name
runoob_title: Set the index field
ALTER TABLE runoob_tbl ADD INDEX indexName (runoob_title);

And then through navicat Software view index , Added a name :indexName The general index of , Field name :runoob_title

3、 Delete index ( It's the same operation )
When deleting an index, you must remember the name of the index
ALTER TABLE runoob_tbl drop INDEX indexName

2、 unique index
UNIQUE: Similar to a normal index , The difference is that : The value of the index column must be unique , But you can have an empty value ( Note that it's different from the primary key ). If it's a composite index , The combination of column values must be unique , The creation method is similar to a normal index
1. Create unique index
CREATE UNIQUE INDEX indexName ON runoob_tbl(runoob_title)
2、 Modify table structure
ALTER table runoob_tbl ADD UNIQUE [indexName] (runoob_title)
3、 Full-text index
FULLTEXT:,FULLTEXT The index can only be used for MyISAM surface ; They can learn from CHAR、VARCHAR or TEXT Column as CREATE TABLE Part of the statement is created , Or use it later ALTER TABLE or CREATE INDEX Be added . For larger datasets , Enter your data into one without FULLTEXT In the indexed table , Then create the index , It's faster than inputting data into existing FULLTEXT Indexing is faster . But remember for large data tables , Generating full-text index is a very time-consuming and hard disk space consuming approach .
4、 Spatial index
SPATIAL: Represents the data type of spatial value , Functions that manipulate space values , Spatial index , Used to provide the speed of accessing spatial columns
边栏推荐
- Voice social system -- improve the audio system industry chain
- 软件架构与设计(六)-----层次结构体
- Software architecture and design (x) -- Architecture Technology
- 软件架构与设计(十)-----架构技术
- How to configure Samba server
- Nftscan and nftplay have reached strategic cooperation in the field of NFT data
- 4. Main program and cumulative interrupt processing routine implementation code
- 关于word文档中插入的图片只显示下面一部分
- Software architecture and design (VIII) -- distributed architecture
- Learn RX programming from me -- concat
猜你喜欢

Getting started with crawlers (1) -- requests (1)

Matlab exports high-definition pictures without distortion in word compression and PDF conversion

How to obtain and embed go binary execution package information

Software architecture and design (IV) -- data flow architecture

Software architecture and design (I) -- key principles

Software architecture and design (VI) -- hierarchy

Voice social system -- improve the audio system industry chain

Minimum heap improves the efficiency of each sort

软件架构与设计(一)-----关键原则

FTP文件传输协议
随机推荐
Preparing for listing in the United States? Arm announced that it would divest the Internet of things service business: the future will focus on the underlying chip design
低成本/小体积模块RS485/232转模拟信号的原理以及应用IBF33
Rxdart is used instead of stateful in fluent
ECCV 2022 | ssp: a new idea of small sample tasks with self-supporting matching
全国211院校考研信息汇总整理
软件架构与设计(六)-----层次结构体
4. Main program and cumulative interrupt processing routine implementation code
Canoe tutorial
Docker容器实现MySQL主从复制
爆肝整理 JVM 十大模块知识点总结,不信你还不懂
String (3)
华为全球员工总数创新高:19.4万人,研发人员占比近50%
突发!微星CEO江胜昌坠楼身亡
Software architecture and design (x) -- Architecture Technology
Stateflow逻辑系统建模
10. Implementation of related data accumulation task
字符串(3)
[channel attention mechanism] senet
Software architecture and design (IX) -- component based architecture
Flutter中是使用RxDart代替Stateful