当前位置:网站首页>SQL optimization
SQL optimization
2022-07-01 23:30:00 【Jingling cat】
limit Optimize
once SQL Analysis of query optimization principle (900W+ data , from 17s To 300ms)
There's a financial statement , Not divided into databases and tables , The current amount of data is 9555695, Paging query uses limit, Query time before optimization 16 s 938 ms (execution: 16 s 831 ms, fetching: 107 ms), Adjust as follows SQL after , Time consuming 347 ms (execution: 163 ms, fetching: 184 ms);
operation : The query criteria are placed in the subquery , Subqueries only look up primary keys ID, Then use the primary key Association determined in the subquery to query other attribute fields ;
principle : Reduce the return operation , Use delay association or subquery to optimize the super multi page scenario .
-- Before optimization SQL
SELECT Various fields
FROM `table_name`
WHERE Various conditions
LIMIT 0,10;
-- After optimization SQL
SELECT Various fields
FROM `table_name` main_tale
RIGHT JOIN
(
SELECT Subqueries only look up primary keys
FROM `table_name`
WHERE Various conditions
LIMIT 0,10;
) temp_table ON temp_table. Primary key = main_table. Primary key
边栏推荐
- 2022 safety officer-c certificate examination question simulation examination question bank and simulation examination
- 13 MySQL-约束
- Know --matplotlib
- The best smart home open source system in 2022: introduction to Alexa, home assistant and homekit ecosystem
- ShanDong Multi-University Training #3
- 图的遍历之深度优先搜索和广度优先搜索
- Microservice stability management
- CKS CKA ckad change terminal to remote desktop
- Why is PHP called hypertext preprocessor
- 字典、哈希表、数组的概念
猜你喜欢

距离度量 —— 汉明距离(Hamming Distance)

2022 safety officer-c certificate examination question simulation examination question bank and simulation examination

What professional classification does the application of Internet of things technology belong to

为什么PHP叫超文本预处理器

How to display real-time 2D map after rviz is opened

Matplotlib常用设置

The best smart home open source system in 2022: introduction to Alexa, home assistant and homekit ecosystem

Experience of practical learning of Silicon Valley products

Aaai22 | structural tagging and interaction modeling: a "slim" network for graph classification

【小程序】通过scroll-view组件实现左右【滑动】列表
随机推荐
ShanDong Multi-University Training #3
股票开户哪个证券公司最好,有安全保障吗
2021 RoboCom 世界机器人开发者大赛-高职组初赛
2022 crane driver (limited to bridge crane) examination questions and simulation examination
Linux foundation - centos7 offline installation of MySQL
The best smart home open source system in 2022: introduction to Alexa, home assistant and homekit ecosystem
2021 RoboCom 世界机器人开发者大赛-本科组初赛
硅谷产品实战学习感触
win 10 mstsc连接 RemoteApp
问题随记 —— /usr/bin/perl is needed by MySQL-server-5.1.73-1.glibc23.x86_64
2022 examination questions and online simulation examination for safety management personnel of hazardous chemical business units
MySQL binlog cleanup
Practical application and extension of plain framework
Typescript enumeration
建模和影视后期有什么关联?
共享电商的背后: 共创、共生、共享、共富,共赢的共富精神
【C#】依赖注入及Autofac
Future trend and development of neural network Internet of things
2022年R1快开门式压力容器操作考题及答案
Yoga27 multidimensional all-in-one computer with excellent appearance and high-end configuration