当前位置:网站首页>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
边栏推荐
- What is the digital transformation of manufacturing industry
- Germany if was crowned with many awards. How strong is this pair of headphones? In depth evaluation of yinpo GTW 270 hybrid
- Redis 分布式鎖
- Is it reliable to open an account on flush with mobile phones? Is there any potential safety hazard
- PR basic clip operation / video export operation
- Golang爬虫框架初探
- SQL question brushing 586 Customers with the most orders
- VMware 虛擬機啟動時出現故障:VMware Workstation 與 Hyper-v 不兼容...
- How to restore the system of Sony laptop
- 机器学习11-聚类,孤立点判别
猜你喜欢

嗨 FUN 一夏,与 StarRocks 一起玩转 SQL Planner!

Dataframe gets the number of words in the string

How to repair the laptop that cannot connect to the wireless network
![[pyg] document summary and project experience (continuously updated](/img/b4/75da8c3e657069be4e3e3bfd5b2dc0.png)
[pyg] document summary and project experience (continuously updated

String类

Rhcsa Road

Tutorial on the principle and application of database system (003) -- MySQL installation and configuration: manually configure MySQL (Windows Environment)

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

Bugku's file contains

为国产数据库添砖加瓦,StoneDB 一体化实时 HTAP 数据库正式开源!
随机推荐
Redis distributed lock
模板引擎Velocity 基础
Leetcode 216 combined summation III -- backtracking method
Introduction to software engineering - Chapter 6 - detailed design
The sharp drop in electricity consumption in Guangdong shows that the substitution of high-tech industries for high-energy consumption industries has achieved preliminary results
机器学习11-聚类,孤立点判别
Kali install Nessus
Go 语言错误处理为什么更推荐使用 pkg/errors 三方库?
Why is the pkg/errors tripartite library more recommended for go language error handling?
你还在用收费的文档管理工具?我这有更牛逼的选择!完全免费
AI高考志愿填报:大厂神仙打架,考生付费围观
数据库系统原理与应用教程(001)—— MySQL 安装与配置:MySQL 软件的安装(windows 环境)
[jetsonnano] [tutorial] [introductory series] [III] build tensorflow environment
模板引擎Velocity 基礎
How to maintain the laptop battery
独家消息:阿里云悄然推出RPA云电脑,已与多家RPA厂商开放合作
SQL question brushing 627 Change gender
China sorbitol Market Forecast and investment strategy report (2022 Edition)
Rhcsa Road
SQL question brushing 1050 Actors and directors who have worked together at least three times