当前位置:网站首页>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
边栏推荐
- Red team Chapter 8: blind guess the difficult utilization process of the package to upload vulnerabilities
- Activity的生命周期和启动模式详解
- SQL question brushing 586 Customers with the most orders
- Concatenate strings to get the result with the smallest dictionary order
- Redis 分布式锁
- China benzene hydrogenation Market Research and investment forecast report (2022 Edition)
- Determine whether the linked list is a palindrome linked list
- AI高考志愿填报:大厂神仙打架,考生付费围观
- SystemVerilog-结构体(二)
- Today, at 14:00, 15 ICLR speakers from Hong Kong University, Beihang, Yale, Tsinghua University, Canada, etc. continue!
猜你喜欢

PR basic clip operation / video export operation

C语言输入/输出流和文件操作

Tutorial on the principle and application of database system (002) -- MySQL installation and configuration: MySQL software uninstallation (Windows Environment)

How to restore the system with one click on Lenovo laptop

博睿数据一体化智能可观测平台入选中国信通院2022年“云原生产品名录”

游戏行业安全选择游戏盾,效果怎么样?

Leetcode 77 combination -- backtracking method

Rhcsa Road

Tutorial on principles and applications of database system (004) -- MySQL installation and configuration: resetting MySQL login password (Windows Environment)

Exclusive news: Alibaba cloud quietly launched RPA cloud computer and has opened cooperation with many RPA manufacturers
随机推荐
How to cancel automatic search and install device drivers for laptops
Bugku's file contains
What are the differences between PHP and DW
How to use F1 to F12 correctly on laptop keyboard
单例模式的懒汉模式跟恶汉模式的区别
毕业季 | 华为专家亲授面试秘诀:如何拿到大厂高薪offer?
Why is the pkg/errors tripartite library more recommended for go language error handling?
Sword finger offer II 015 All modifiers in the string
China BMS battery management system Market Research Report (2022 Edition)
【直播预约】数据库OBCP认证全面升级公开课
VMware 虛擬機啟動時出現故障:VMware Workstation 與 Hyper-v 不兼容...
Advantages, values and risks of chain games compared with traditional games
Redis6.0 new features
China benzene hydrogenation Market Research and investment forecast report (2022 Edition)
Go 语言怎么使用对称加密?
String类
Activity的生命周期和启动模式详解
[observation] where is the consulting going in the digital age? Thoughts and actions of softcom consulting
String class
机器学习11-聚类,孤立点判别