当前位置:网站首页>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
边栏推荐
- Jielizhi Bluetooth headset quality control and production skills [chapter]
- typescript枚举
- De PIP. Interne. CLI. Main Import main modulenotfounderror: No module named 'PIP'
- 常见的积分商城游戏类型有哪些?
- "35 years old, the boss of the company, with a monthly salary of 20000, give away takeout": the times abandoned you, not even saying goodbye
- VIM color the catalogue
- MySQL -- convert rownum in Oracle to MySQL
- URL introduction
- Why is PHP called hypertext preprocessor
- The online beggar function of Japanese shopping websites
猜你喜欢
2021 RoboCom 世界机器人开发者大赛-本科组初赛
神经网络物联网的未来趋势与发展
字典、哈希表、数组的概念
Three development trends of enterprise application from the perspective of the third technological revolution
Yunxin small class | common cognitive misunderstandings in IM and audio and video
Airserver latest win64 bit personal screen projection software
Zhao Fuquan: to ensure supply in the short term, we should build a safe, efficient and resilient supply chain in the long term
从第三次技术革命看企业应用三大开发趋势
认识--Matplotlib
Commemorate becoming the first dayus200 tripartite demo contributor
随机推荐
RPA: Bank digitalization, business process automation "a small step", and loan review efficiency "a big step"
Development trend and future direction of neural network Internet of things
Is it safe to choose mobile phone for stock trading account opening in Shanghai?
Y53. Chapter III kubernetes from introduction to mastery -- ingress (26)
[understanding of opportunity-35]: Guiguzi - flying clamp - the art of remote connection, remote control and remote testing
2022 R1 fast opening pressure vessel operation test questions and answers
每日三题 6.28
Concepts of dictionary, hash table and array
会声会影2022智能、快速、简单的视频剪辑软件
2022年危险化学品经营单位安全管理人员考试题及在线模拟考试
Postgresql源码(57)HOT更新为什么性能差距那么大?
2021 RoboCom 世界机器人开发者大赛-高职组复赛
Practical application and extension of plain framework
Behind sharing e-commerce: the spirit of CO creation, symbiosis, sharing, CO prosperity and win-win
The online beggar function of Japanese shopping websites
STM32F030F4驱动TIM1637数码管芯片
Current situation and future development trend of Internet of things
想请教股票开户要认识谁?在线开户是安全么?
mt管理器测试滑雪大冒险
2022-07-01:某公司年会上,大家要玩一食发奖金游戏,一共有n个员工, 每个员工都有建设积分和捣乱积分, 他们需要排成一队,在队伍最前面的一定是老板