当前位置:网站首页>How to create an index when sql uses where and groupby?
How to create an index when sql uses where and groupby?
2022-08-11 01:40:00 【CSDN q&a】
When optimizing sql, due to the large amount of data, a simple sql but the execution speed is very slow
SELECT max( id ) FROM log WHERE create_date <= "2022-08-03" GROUP BY code
I have tried a variety of situations, create_date, code, (code, create_date), (create_date, code), using (code, create_date) to combine the index takes only 1 second at the fastest, using the explain command to view the two columns of the index useArrived, others need about 10 seconds
According to the information found on the Internet, a (create_date, code) index can be established. After all, where first and then groupby, but using explain, you can see that only create_date is actually used in the combined index
Why (code, create_date) is the mostQuick, what's the point of this
边栏推荐
- The SAP ABAP JSON format data processing
- 如何做到构建的提速,再提速
- Single-chip human-computer interaction--matrix key
- R language multiple linear regression, ARIMA analysis of the impact of different candidates in the United States on the economic GDP time series
- Word set before the title page
- 联盛德W801系列6-从微信小程序的角度来分析W801的蓝牙通信源码(indicate方式)
- Data Analysis Interview Manual "SQL"
- 异常和异常处理机制
- Sigma development pays attention to details
- loop word
猜你喜欢
随机推荐
networkmanager无法打开
双机热备综合实验(VRRP+OSPF+VTP+NAT+DHCP+PVSTP+单臂路由)
Data Filters in ABP
异常和异常处理机制
络达开发---自定义BLE服务(二):功能实现
Flink二阶段提交
How to build speed, speed up again
postgresql parameter meaning
88Q2110 通过C22方式访问C45 phy地址
微服务概念
apache+PHP+MySQL+word press,安装word press时页面报错?
winform下的富文本编辑器
二维数组实战项目--------《扫雷游戏》
apache+PHP+MySQL+word press, page error when installing word press?
Apache Commons Configuration远程代码执行漏洞(CVE-2022-33980)分析&复现
[GXYCTF2019]BabySQli
【21天学习挑战赛】折半插入排序
BEVDepth: Acquisition of Reliable Depth for Multi-view 3D Object Detection Paper Notes
[ASM] The relationship between the role of the bytecode operation ClassWriter COMPUTE_FRAMES and visitMaxs
Shell 文本三剑客 Sed