当前位置:网站首页>MySQL learning summary
MySQL learning summary
2022-07-01 16:52:00 【lix_ uan】
Three paradigms of database
First normal form
: No more columns can be splitSecond normal form
: On the basis of the first paradigm , Non primary key columns are completely dependent on the primary keyThird normal form
: In the second paradigm , Non primary key columns only depend on primary keys , Do not rely on other non primary keys
Concurrency of transactions
Dirty reading
: Business A Read transaction B Updated data , Then the data B Roll back , that A Read dirty dataIt can't be read repeatedly
: Business A Read the same data multiple times , Business B In the transaction A In the process of reading, the data is modified and submitted , Lead to A The data read many times is differentFantasy reading
: Business A When reading data , Business B Added data , Lead to A After reading, I found that there was still data I didn't read- Unrepeatable reading focuses on revision , Unreal reading focuses on adding or deleting
- To solve the problem of unrepeatable reading, you only need to lock the line , To solve phantom reading, you need to lock the table
The isolation level of the transaction
Transaction isolation level | Dirty reading | It can't be read repeatedly |
---|---|---|
Read uncommitted | yes | yes |
It can't be read repeatedly | no | yes |
Repeatable | no | no |
Serialization | no | no |
b-tree、b+tree The difference between
- b-tree Key words of 、 Indexes and records are put together
- b+tree Records of are only placed in leaf nodes , Instead of leaf nodes, there are only keywords and indexes pointing to the next node
- b-tree The closer to the root node, the faster the record lookup event , Just find the keyword to confirm the existence of the record
- b+tree The search events of each record in are basically the same , You need to go from the root node to the leaf node
- b+tree The cost of disk reading and writing is lower , Query efficiency is more stable ,b+tree More suitable for indexing
drop、delete、truncate The difference between
- Use it directly when you don't need another table drop Delete
- Delete all data , But keep the table structure with truncate
- Use when you want to delete some data delete
union and union all The difference between
- union It will get more data for de duplication and sorting
- union all All query results will be preserved , There will be no de duplication and sorting
- Without losing weight ,union all It's more efficient
char and varchar The difference between
- char, Fixed length , Fixed length strings are recommended char Type storage , Space saving and efficient
- varchar, Indefinite length , Low efficiency
Why should a field be defined as not null
- null Values take up more bytes , And it will cause many unexpected situations in the program
边栏推荐
- How to solve the keyboard key failure of notebook computer
- How to repair the laptop that cannot connect to the wireless network
- SQL question brushing 586 Customers with the most orders
- How to use F1 to F12 correctly on laptop keyboard
- Template Engine Velocity Foundation
- 如何使用phpIPAM来管理IP地址和子网
- Kali install Nessus
- 机器学习11-聚类,孤立点判别
- Research and investment strategy report of China's sodium sulfate industry (2022 Edition)
- Go 语言怎么使用对称加密?
猜你喜欢
毕业季 | 华为专家亲授面试秘诀:如何拿到大厂高薪offer?
How to solve the problem that the battery icon of notebook computer does not display
What is the digital transformation of manufacturing industry
Redis6.0 新功能
Free lottery | explore the future series of blind box digital copyright works of "abadou" will be launched on the whole network!
数据库系统原理与应用教程(003)—— MySQL 安装与配置:手工配置 MySQL(windows 环境)
Flux d'entrées / sorties et opérations de fichiers en langage C
Stegano in the world of attack and defense
Redis 分布式鎖
Comprehensively view the value of enterprise digital transformation
随机推荐
The difference between the lazy mode of singleton mode and the evil mode
[JetsonNano] [教程] [入门系列] [三] 搭建TensorFlow环境
How to repair the laptop that cannot connect to the wireless network
剑指 Offer II 015. 字符串中的所有变位词
How to restore the system with one click on Lenovo laptop
Concatenate strings to get the result with the smallest dictionary order
Activity的生命周期和启动模式详解
C語言輸入/輸出流和文件操作
Girls who want to do software testing look here
【C语言基础】12 字符串
Origin2018安装与使用(整理中)
Alibaba cloud, Zhuoyi technology beach grabbing dialogue AI
软件工程导论——第六章——详细设计
数据库系统原理与应用教程(006)—— 编译安装 MySQL5.7(Linux 环境)
Défaillance lors du démarrage de la machine virtuelle VMware: le poste de travail VMware n'est pas compatible avec hyper - V...
Tutorial on principles and applications of database system (004) -- MySQL installation and configuration: resetting MySQL login password (Windows Environment)
Redis6.0 新功能
PR basic clip operation / video export operation
数据库系统原理与应用教程(001)—— MySQL 安装与配置:MySQL 软件的安装(windows 环境)
Authentication processing in interface testing framework