当前位置:网站首页>MySQL存储引擎
MySQL存储引擎
2022-07-06 00:16:00 【不断完善的楠】
MySQL存储引擎
1.什么是数据库存储引擎?
数据库引擎:是用于存储、处理和保护数据的核心服务。利用数据库引擎可控制访问权限并快速处理事务,从而满足企业内大多数需要处理大量数据的应用程序的要求。
2.默认的存储引擎是InnoDB
1.利用 show create table 表名 sql语句来查看默认的存储引擎是啥
3.查看数据库的存储引擎
sql语句:show engines;
4.创建表并制定表的存储引擎
1.创建数据表并且制定表存储引擎为MyISAM;
2.创建数据表并且制定表存储引擎为Memory;
5.InnoDB存储引擎
1.InnoDB是什么?
InnoDB是一种兼顾 高可靠性和 高性能的通用存储引擎。
2.InnoDB的特点是什么?
1.DML(数据操作语言:增删改查)操作遵循ACID(事务四大特性:原子性、一致性、隔离性、持久性)模型,支持事务;
2.行级锁,提高并发访问性能;
3.支持外键foreign key约束,保证数据的完整性和正确性。
4.支持奔溃修复和自增列。
3.InnoDB优缺点的分析:
InnoDB的优势是支持事务、支持外键、支持奔溃修复和自增列。通过InnoDB来控制事务的提交和回滚,从而保证业务的完整性。
InnoDB的缺点是读写效率低,占用数据空间较大。
6.数据库表级锁和行级锁
1.MySQL数据库的锁机制:不同的存储引擎支持不同的锁机制。
MyISAM和MEMORY存储引擎采用的是表级锁。
InnoDB存储引擎即支持行级锁,也支持表级锁,默认采用的是行级锁。
2.MySQL主要的两种锁的特性:
表级锁:每次操作锁整张表,开销小,加锁快,不会出现死锁,发生锁冲突的概率高,并发度低;
行级锁:每次操作锁一行数据,开销大,加锁慢,会出现死锁,发生锁冲突概率低,并发度高。
7.MyISAM
1.MyISAM是早期MySQL早期默认存储引擎。
特点:1.不支持事务,不支持外键;
2.支持表锁,不支持行锁;
3.访问速度快
特点:
xxx.sdi:存储表结构信息;
xxx.MYD:存储数据;
xxx.MYI:存储索引。
2.MyISAM优缺点分析:
MyISAM引擎保存了单独的索引文件.myi,且它的索引是直接定位到OFFSET的,而InnoDB没有单独的物理索引存储文件,InnoDB索引寻址是先定位到块数据,再定位到行数据,所以,MyISAM的查询效率是比InnoDB的查询效率高,但是它不支持事务,不支持外键,适用场景是读多写少,且对完整性要求不高的业务场景。
8.Memory
1.Memory的定义
Memory:内存型数据库引擎,所以的数据都存在内存中,读写效率很高,但是MySQL服务重启后,数据会丢失,它不支持事务、外键,memory支持hash索引或者B树索引,hash索引是基于key查询的,查询效率较高,如果是基于范围查询的效率就比较低。InnoDB和MyISAM是基于B+树的数据结构实现的。
2.Memory优缺点分析
Memory读写能力高,但是MySQL重启之后,数据会丢失,不支持外键和事务。
适用场景:读写效率要求高,且对数据丢失不敏感的业务场景。
边栏推荐
- What is information security? What is included? What is the difference with network security?
- Codeforces Round #804 (Div. 2)【比赛记录】
- [binary search tree] add, delete, modify and query function code implementation
- MySQL之函数
- 多普勒效應(多普勒頻移)
- Upgrade openssl-1.1.1p for openssl-1.0.2k
- 【QT】Qt使用QJson生成json文件并保存
- 7.5 装饰器
- FFT 学习笔记(自认为详细)
- Single merchant v4.4 has the same original intention and strength!
猜你喜欢

What are the functions of Yunna fixed assets management system?

Tools to improve work efficiency: the idea of SQL batch generation tools

数据库遇到的问题

openssl-1.0.2k版本升级openssl-1.1.1p

Room cannot create an SQLite connection to verify the queries

After summarizing more than 800 kubectl aliases, I'm no longer afraid that I can't remember commands!

How to solve the problems caused by the import process of ecology9.0

上门预约服务类的App功能详解

LeetCode 1189. Maximum number of "balloons"

Yunna | what are the main operating processes of the fixed assets management system
随机推荐
选择致敬持续奋斗背后的精神——对话威尔价值观【第四期】
What if the C disk is not enough? Let's see how I can clean up 25g of temp disk space after I haven't redone the system for 4 years?
SQLServer连接数据库读取中文乱码问题解决
FFT learning notes (I think it is detailed)
【二叉搜索树】增删改查功能代码实现
[designmode] composite mode
Add noise randomly to open3d point cloud
Key structure of ffmpeg -- AVCodecContext
Senparc. Weixin. Sample. MP source code analysis
[noi simulation] Anaid's tree (Mobius inversion, exponential generating function, Ehrlich sieve, virtual tree)
Hardware and interface learning summary
认识提取与显示梅尔谱图的小实验(观察不同y_axis和x_axis的区别)
Global and Chinese markets of POM plastic gears 2022-2028: Research Report on technology, participants, trends, market size and share
Detailed explanation of APP functions of door-to-door appointment service
7.5 decorator
[QT] QT uses qjson to generate JSON files and save them
数据库遇到的问题
Problems encountered in the database
Chapter 16 oauth2authorizationrequestredirectwebfilter source code analysis
Atcoder beginer contest 254 [VP record]



