当前位置:网站首页>Date of SQL optimization_ Format() function
Date of SQL optimization_ Format() function
2022-06-11 20:08:00 【A man who didn't want to be named】
There is a problem in the online environment today , Front end interface request timed out , I immediately ran to the formal environment to run the request timeout sql, Shock me , It's running well 30 More than a second , This is not acceptable. , We have to optimize it quickly , But there is something left to look up and down , No problem! , therefore , Asked the great God of our group , He saw the problem at a glance , The problem is DATE_FORMAT() This function , So , I want to make a record , I hope you don't step on the pit .
If the amount of data is small , Application DATE_FORMAT() Performance is not affected , But once the amount of data is large After that , There will be performance problems slowly , This is also because the test environment did not find out , This problem occurs in the formal environment .
For demonstration : I put it in my watch
Tens of millions of data ,

The data structure is like this , I want to find out regist_date yes 2018 Years of data
I'll fix this sql:

when :
After optimization, execute :
![]()
Performance is flying :
Why , because DATE_FORMAT Function will invalidate the index , Therefore, this function is not recommended for large data volume .
边栏推荐
- 【mysql进阶】10种数据类型的区别以及如何优化表结构(三)
- 干货!基于序列超图神经网络的信息扩散预测
- 计算926的9260次方里的字符串里有多少个926
- In 2021, the global barite product revenue was about $571.3 million, and it is expected to reach $710.2 million in 2028
- AHB2Standard_handshake_bridge 设计
- 2022-2028 current market situation and future development trend of thermopile Pyranometers in the world and China
- WR | 西湖大学鞠峰组微纳塑料污染对人工湿地菌群与脱氮功能的影响
- The principle that the picture of QQ Post Bar changes when it is opened
- [advanced MySQL] differences among 10 data types and how to optimize the table structure (3)
- Template and requirements of curriculum design of reinforced concrete structure in autumn 21 of Dagong [standard answer]
猜你喜欢

7905 和TL431 负电压稳压电路 - 相对于电源正极的稳压和浮地电路

29. location对象

Tensorflow --- creation and reading of tfrecord file

上海内推 | 上海期智研究院于洋老师课题组招收全职研究员

In 2021, the global barite product revenue was about $571.3 million, and it is expected to reach $710.2 million in 2028

29. Objet de localisation

Flutter Doctor affiche les solutions que xcode n'a pas installées

计算926的9260次方里的字符串里有多少个926

First modelarts training

26. 定时器
随机推荐
[high precision] decimal integer addition
AHB_Bus_Matrix_3x3 设计
Rtd2171u, substitute for trd2171u, substitute for trd2171u, cs5261 C to hdmi4k_ 30Hz
上海内推 | 上海期智研究院于洋老师课题组招收全职研究员
Leetcode 1992. Find all farm groups (yes, once)
Detailed explanation on persistence of 2022redis7.0x
My favorite product management template - Lenny
27. this指向问题
Simulate Oracle lock waiting and manual unlocking
AHB2Standard_handshake_bridge 设计
接口隔离原则
2022-2028 global and Chinese thermal ionization isotope mass spectrometer (TIMS) market status and future development trend
秀创意,赢显卡!MMPose姿态估计创意大赛震撼来袭
This article introduces you to the infrastructure of sofaregistry
模块八作业
Edit the project steps to run QT and opencv in the clion
27. this pointing problem
28. JS执行机制
dried food! Information diffusion prediction based on sequence hypergraph neural network
Web3 product manager guide - Jason