当前位置:网站首页>How does MySQL create, delete, and view indexes?
How does MySQL create, delete, and view indexes?
2022-07-07 12:51:00 【Full stack programmer webmaster】
mysql It is an open source database with a wide range of applications .mysql The index inside can use pointers , Can greatly improve the query efficiency . Especially when the amount of data is very large , When a query involves multiple tables , Using indexes can often speed up queries thousands of times . that , How to create an index ?
- First step , Create a table , The structure is as follows :create table t (id int unsigned not null,name varchar(20) not null default ‘-‘);
- The second step , Add index , Second, the index is divided into several categories , General index , primary key , And unique index , The steps are shown in the figure : Number in the figure 123 It corresponds to the general index , primary key , And unique index alter table Table name add index/unique/primary key ( Index name );
- The third step , There is already an index in the table , How to check ? With these two commands :show index from table; or show keys from table; Pictured : show index from Table name ; show keys from Table name ;
- Step four , Sometimes there are too many indexes , It will cause the performance of adding, deleting, modifying and checking , So you can create it and delete it , The order is as follows : drop index Index name on Table name ; DROP INDEX index_name ON talbe_name; ALTER TABLE table_name DROP INDEX index_name; ALTER TABLE table_name DROP PRIMARY KEY;
- Step five , When deleting the index above , There was a mistake , Say that the index name cannot be found , Because it was deleted the first time , therefore , This index name no longer exists , Pictured
- Step six , Query the index again , Whether the deletion was successful , Repeat the command in step 3 , The result is shown in Fig. , The description has been deleted
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/113449.html Link to the original text :https://javaforall.cn
边栏推荐
- JS to convert array to tree data
- 2022 practice questions and mock examination of the third batch of Guangdong Provincial Safety Officer a certificate (main person in charge)
- Steps of building SSM framework
- 有什么类方法或是函数可以查看某个项目的Laravel版本的?
- Talk about four cluster schemes of redis cache, and their advantages and disadvantages
- layer弹出层的关闭问题
- HZOJ #236. 递归实现组合型枚举
- Preorder, inorder and postorder traversal of binary tree
- 【从 0 开始学微服务】【03】初探微服务架构
- Four functions of opencv
猜你喜欢

数据库安全的重要性

ACL 2022 | small sample ner of sequence annotation: dual tower Bert model integrating tag semantics
![[pytorch practice] image description -- let neural network read pictures and tell stories](/img/39/b2c61ae0668507f50426b01f2deee4.png)
[pytorch practice] image description -- let neural network read pictures and tell stories

MPLS experiment

图形对象的创建与赋值

Pule frog small 5D movie equipment | 5D movie dynamic movie experience hall | VR scenic area cinema equipment

What if does not match your user account appears when submitting the code?

The left-hand side of an assignment expression may not be an optional property access. ts(2779)

3D content generation based on nerf

基于NeRF的三维内容生成
随机推荐
[pytorch practice] use pytorch to realize image style migration based on neural network
《ASP.NET Core 6框架揭秘》样章[200页/5章]
[learn wechat from 0] [00] Course Overview
Day-17 connection set
Day-18 hash table, generic
CMU15445 (Fall 2019) 之 Project#2 - Hash Table 详解
【统计学习方法】学习笔记——逻辑斯谛回归和最大熵模型
On valuation model (II): PE index II - PE band
Find ID value MySQL in string
The left-hand side of an assignment expression may not be an optional property access. ts(2779)
What is an esp/msr partition and how to create an esp/msr partition
Session
HZOJ #235. 递归实现指数型枚举
@Resource和@Autowired的区别?
OSPF exercise Report
HZOJ #236. Recursive implementation of combinatorial enumeration
Leetcode skimming: binary tree 22 (minimum absolute difference of binary search tree)
Utiliser la pile pour convertir le binaire en décimal
ip2long之后有什么好处?
博文推荐|Apache Pulsar 跨地域复制方案选型实践