当前位置:网站首页>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%,所以也不要太在意,只是在大数据导入时,可以先删除索引,再批量插入数据,最后再添加索引
边栏推荐
- OSPF - detailed explanation of GRE tunnel (including configuration command)
- 2022-2028 global open source cloud storage industry research and trend analysis report
- 你好,请问老师,在支付宝基金开户真的安全吗?
- When we talk about the metauniverse, what are we talking about?
- China soft magnetic material market demand status and prospect scale forecast report 2022-2028
- Audio orchestrator: orchestrate immersive interactive audio using multiple devices
- Hello, teacher, is it really safe to open an account in Alipay fund?
- Market demand analysis and investment prospect research report of China's CNC machine tool industry 2022-2028
- To ensure the Beijing Winter Olympic Games, digital data gives a power without code!
- [intensive lecture] 2022 PHP intermediate and advanced interview questions (II)
猜你喜欢

2022-2028 global SiC igniter industry research and trend analysis report

Beyond natural motion: exploring the discontinuity of video interpolation

2022-2028 global horizontal reciprocating compressor industry research and trend analysis report

Talk about adapter mode

2022-2028 global TFT touch screen industry research and trend analysis report

Zhihu Gaozan: what ability is important, but most people don't have it?

数据治理,说起来容易,做起来难

Privatization lightweight continuous integration deployment scheme -- 03 deployment of Web services (Part 2)

Nacos source code analysis 01 code structure

Use apiccloud AVM multi terminal component to quickly realize the search function in the app
随机推荐
Openwrt (VIII) application layer development
Pycharm 2022.1 EAP 2 release
2022-2028 global open source cloud storage industry research and trend analysis report
Nacos source code analysis 01 code structure
2022-2028 global co extrusion production line industry research and trend analysis report
Webrtc crash course
圖解棧幀運行過程
Unity技术手册 - 粒子基础主模块属性-上
St2110 network connected display for virtualized production
Does jQuery cache any selectors- Does jQuery do any kind of caching of “selectors”?
Open source optimized VVC encoder in general scenarios
Travel notes of 2022giao
[dynamic programming] longest palindrome substring thinking about dynamic transfer cycle sequence
Analysis report on market demand situation and investment direction of China's optical transmission equipment industry from 2022 to 2028
2022-2028 global TFT touch screen industry research and trend analysis report
Adaptive streaming playback statistics set
Practice of product library platform nexus of Devops
Facing the "industry, University and research" gap in AI talent training, how can shengteng AI enrich the black land of industrial talents?
3.4 cloning and host time synchronization of VMware virtual machine
2022-2028 global proton exchange membrane hydrogen electrolyzer industry survey and trend analysis report