当前位置:网站首页>Optimize the query (work in progress)
Optimize the query (work in progress)
2022-08-03 22:03:00 【penguin that wants to fly】
Scenario: Double-table joint query cannot be used, only by querying a single table, the query result can be used as the query condition of the second table.
Solution: First of all, it must be clear that java establishes query connections with the database many times, and the query will consume a lot of time. What optimization needs to be done is to reduce the time, so that the number of times that java establishes a connection with the database for query can be reduced.time.
Idea 1 (unoptimized): traverse the found data in Table 1, obtain the attributes required by the corresponding Table 2 during the traversal, and directly query it in Table 2 to obtain the results of Table 2 until the traversal ends.
Idea 2 (optimization): Find the data in Table 1, then put the data in Table 1 that needs to be used in Table 2 into the collection, and then query in Table 2 according to the data in the collection, and then inFilter the found data according to the conditional attributes to get the desired data.
It may be a bit laborious to say this, but the idea of optimization is to reduce the number of connections to the database, because this connection is time-consuming. Through the algorithm, the data range is too large by reducing the number of connections before.desired data.
边栏推荐
猜你喜欢
随机推荐
CAS: 1192802-98-4 _uv cracking of biotin - PEG2 - azide
上课笔记(6)(1)——#629. 表达式括号匹配(stack)
超级实用网站+公众号合集
C. Divan and bitwise operations
[3D检测系列-PV-RCNN] PV-RCNN论文详解、PV-RCNN代码复现、包含官网PV-RCNN预训练权重及报错问题
6. XML
shell编程基础
Cisco ike2 IPSec配置
DO280管理和监控OpenShift平台--资源限制
Security Fundamentals 8 --- XSS
Shell编程的条件语句
九种方式,教你读取 resources 目录下的文件路径
UVa 1025 - A Spy in the Metro(白书)
数据一致性:双删为什么要延时?
Makefile
ValidationError: Progress Plugin Invalid Options
XSS online shooting range---prompt
优化查询(工作中)
LitJson报错记录
距LiveVideoStackCon 2022 上海站开幕还有2天!









