当前位置:网站首页>Some small knowledge points
Some small knowledge points
2022-07-01 04:12:00 【speoki】
(1) Use mysql Doing set operations
1. Combine union Union and collection
SELECT product_id, product_name
FROM product
UNION
SELECT product_id, product_name
FROM product2;
2. Difference set not in
SELECT *
FROM Product
WHERE product_id NOT IN (SELECT product_id
FROM Product2)
3. intersection inner join
SELECT p1.product_id, p1.product_name
FROM Product p1
INNER JOIN Product2 p2
ON p1.product_id=p2.product_id
- Symmetry difference
SELECT *
FROM Product
WHERE product_id NOT IN (SELECT product_id FROM Product2)
UNION
SELECT *
FROM Product2
WHERE product_id NOT IN (SELECT product_id FROM Product)
5. Cartesian product cross join
The cartesian product :
SELECT SP.shop_id
,SP.shop_name
,SP.product_id
,P.product_name
,P.sale_price
FROM ShopProduct AS SP
CROSS JOIN Product AS P;
(2)mysql Ways to break the deadlock
Set the timeout for transaction waiting
innodb_lock_wait_timeout
- Enable active deadlock detection
innodb_deadlock_detect
(3) View the latest deadlock information
show engine innodb status
(4)mysql To perform a sql Statement flow
The first step is actually to query the cache , however mysql8 Query cache canceled . Although query caching improves system performance , But the overhead of maintaining the cache is also relatively large
Parsing statements ( Query analysis )
select title from order where id=1
① Lexical analysis Extract keywords , The above sentence sql Will be divided into 8 Parts of
stay elasticsearch The engine also has a dictionary to segment sentences
② Syntax analysis According to the result of lexical analysis , Generate syntax tree ( The parse tree ), Judge sql Whether the statement satisfies the syntax rules .
If there is a syntax error in the statement, it will be displayed at this time ‘You have an error in your SQL syntax’
- Search and check ( The preprocessor )
① Semantic analysis
Form a semantic tree transformed from relational algebra
② Symbol name conversion
Bind variables to definitions in symbol table
If the field name and table name do not exist, an error will be reported UnKnow column ‘abc’ in ‘field list’
③ Safety inspection
- Autonomous access control
- Forced access control
④ Preliminary integrity check
- Referential integrity
- Entity integrity
- User defined integrity
- Query optimization ( Optimizer )
mysql Use an overhead based optimizer , Choose a plan that costs less
mysql By querying the current session last_query_cost To calculate the cost of the current query
see last_query_cost The order of :show status like ‘last_query_cost’
The costs considered may be : Number of pages per table or index , The cardinality of the index , Index and data row length . Index distribution, etc .
The optimization strategies are :
① Redefine the order in which tables are associated , It depends on the size of the watch , Or it is possible to convert an outer connection to an inner connection , The subquery is transformed into a connection
② Optimize to find the maximum and minimum functions
③ Optimization of sorting
…
- Query execution ( actuator )
Generate an execution plan for the execution strategy obtained above , Let the code generator execute the query plan , Take the data from the storage engine and return it to the client
边栏推荐
- 【TA-霜狼_may-《百人计划》】1.1 渲染流水线
- PageObject模式解析及案例
- Mallbook: how can hotel enterprises break the situation in the post epidemic era?
- 8. string conversion integer (ATOI)
- 318. Maximum word length product
- Coinbase in a bear market: losses, layoffs, stock price plunges
- 【TA-霜狼_may-《百人計劃》】2.3 常用函數介紹
- 208. implement trie (prefix tree)
- “目标检测“+“视觉理解“实现对输入图像的理解
- 241. Design priorities for operational expressions
猜你喜欢
![[ta- frost wolf \u may- hundred people plan] 2.2 model and material space](/img/93/95ee3d4389ffd227559dc8b3207e1d.png)
[ta- frost wolf \u may- hundred people plan] 2.2 model and material space
![[TA frost wolf \u may- hundred people plan] 2.3 introduction to common functions](/img/be/325f78dee744138a865c13d2c20475.png)
[TA frost wolf \u may- hundred people plan] 2.3 introduction to common functions

Leetcode learning - day 36

【人话版】WEB3黑暗森林中的隐私博弈

使用WinMTR软件简单分析跟踪检测网络路由情况

DO280管理应用部署--RC

Use selenium automated test tool to climb the enrollment score line and ranking of colleges and universities related to the college entrance examination

Edge浏览器的小技巧:Enter+Ctrl可以自动将地址栏转换为网址
【历史上的今天】6 月 30 日:冯·诺依曼发表第一份草案;九十年代末的半导体大战;CBS 收购 CNET

HoloLens2开发环境搭建及部署app
随机推荐
It's settled! 2022 JD cloud summit of JD global technology Explorer conference see you in Beijing on July 13
Edge浏览器的小技巧:Enter+Ctrl可以自动将地址栏转换为网址
409. longest palindrome
Loop filtering based on Unet
214. minimum palindrome string
LeetCode 1380. Lucky number in matrix
使用scroll-view实现滑块视图可能遇到的问题及其解决方法
168. excel table column name
【人话版】WEB3黑暗森林中的隐私博弈
熊市下的Coinbase:亏损、裁员、股价暴跌
Grid system in bootstrap
Libevent Library Learning
类和对象收尾
How to ensure the idempotency of the high concurrency interface?
JMeter学习笔记2-图形界面简单介绍
MFC window scroll bar usage
8. string conversion integer (ATOI)
Use of JMeter counters
"Target detection" + "visual understanding" realizes the understanding of the input image
[EI search] important information conference of the 6th International Conference on materials engineering and advanced manufacturing technology (meamt 2022) in 2022 website: www.meamt Org meeting time