当前位置:网站首页>MySQL数据库索引
MySQL数据库索引
2022-06-25 21:50:00 【Forestᝰ】
索引语法
查看索引showindexfrom表名;创建索引方式一:建表时创建索引createtablecreate_index(idintprimarykey,namevarchar(10)unique,ageint,key(age));方式二:对于已经存在的表,添加索引如果指定字段是字符串,需要指定长度,建议长度与定义字段时的长度一致字段类型如果不是字符串,可以不填写长度部分createindex索引名称on表名(字段名称(长度))例:createindexage_indexoncreate_index(age);createindexname_indexoncreate_index(name(10));删除索引:dropindex索引名称on表名;3.索引缺点虽然索引大大提高了查询速度,同时却会降低更新表的速度,如对表进行INSERT、UPDATE和DELETE,因为更新表时,MySQL不仅要保存数据,还要保存一下索引文件但是,在互联网应用中,查询的语句远远大于增删改的语句,甚至可以占到80%~90%,所以也不要太在意,只是在大数据导入时,可以先删除索引,再批量插入数据,最后再添加索引
边栏推荐
- Global and Chinese flame retardant ABS industry development trend and market demand analysis report 2022 ~ 2028
- Open source optimized VVC encoder in general scenarios
- Huasheng lithium battery IPO meeting: 9-month revenue of 690million; shenjinliang's family relationship is complex
- Lecture 14 of the Blue Bridge Cup -- number theory [exercises]
- Obsidian基础教程
- 记|一次exists关键字的学习记录
- Adaptive streaming playback statistics set
- QT learning setting executable exe attribute (solving the problem of Chinese attribute garbled)
- [dynamic programming] longest palindrome substring thinking about dynamic transfer cycle sequence
- Summary of basic knowledge of neural network
猜你喜欢

Huasheng lithium battery IPO meeting: 9-month revenue of 690million; shenjinliang's family relationship is complex
![[WPF] XAML code skills that can be directly used for converting CAD engineering drawings to WPF](/img/a1/09d2dc0ec47c54530da4d42d218d1c.jpg)
[WPF] XAML code skills that can be directly used for converting CAD engineering drawings to WPF

Why absolute positioning overlaps

Ribbon core ⼼ source code analysis

聊聊Adapter模式
Data annotation in the second half: growth flywheel under PLG mode Manfu Technology

Illustration de l'exécution du cadre de pile

OSPF - detailed explanation of GRE tunnel (including configuration command)

Yyds dry goods inventory CEPH installation visual dashboard

Data governance is easier said than done
随机推荐
[WPF] XAML code skills that can be directly used for converting CAD engineering drawings to WPF
2022-2028 global transmission type photoelectric circuit breaker industry research and trend analysis report
Basic concepts of processor scheduling
面对AI人才培养的“产学研”鸿沟,昇腾AI如何做厚产业人才黑土地?
2022-2028 global TFT LCD touch screen industry research and trend analysis report
2022giao考游记
记|一次exists关键字的学习记录
Does jQuery cache any selectors- Does jQuery do any kind of caching of “selectors”?
How to disable the optical drive
2022-2028 global SiC igniter industry research and trend analysis report
Development trend of China's power carrier communication industry and Research Report on the 14th five year plan 2022 ~ 2028
c语言与数据库的创建使用
[invitation letter] on March 4, the platform enabled digital intelligence Innovation -- UFIDA BiP PAAS cloud platform IUAP digital intelligence hundred cities forum · Jinan Station
Jz-064- maximum value of sliding window
2022-2028 global industrial touch screen industry research and trend analysis report
Chapter 3 use of requests Library
2022-2028 global DC linear variable differential transformer (LVDT) industry survey and trend analysis report
Client cannot authenticate via:[TOKEN, KERBEROS]
Generic cmaf container for efficient cross format low latency delivery
OSPF - detailed explanation of GRE tunnel (including configuration command)