当前位置:网站首页>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.
边栏推荐
- L2-029 特立独行的幸福
- 授人以渔 - 如何自行查询任意 SAP UI5 控件属性的文档和技术实现细节试读版
- 488. Zuma Game
- 封装、包、访问权限修饰符、static变量
- C. awoo‘s Favorite Problem--Educational Codeforces Round 130 (Rated for Div. 2)
- CAS: 773888-45-2_BIOTIN ALKYNE_生物素-炔基
- 嵌入式系统:概述
- E-commerce data warehouse ODS layer-----log data loading
- 384. Shuffle an Array
- Android build error: Plugin with id 'kotlin-android' not found.
猜你喜欢
随机推荐
Makefile
Kubernetes入门到精通-Operator 模式
Android build error: Plugin with id 'kotlin-android' not found.
七夕快乐!
数据一致性:双删为什么要延时?
gtk实现图片旋转
这几个常用 alias,带你高效做事(下)
XSS testing
XSS online shooting range---prompt
【kali-漏洞扫描】(2.1)Nessus解除IP限制、扫描快无结果、插件plugins被删除(中)
测试2年6.5K,每天“911”,我的心酸经历只有我自己知道···
UVa 10003 - Cutting Sticks(白书,区间DP)
[kali-vulnerability scanning] (2.1) Nessus download and installation (on)
ValidationError: Progress Plugin Invalid Options
『百日百题 · 基础篇』备战面试,坚持刷题 第四话——循环语句!
HCIP第十四天
剑指 Offer 16. 数值的整数次方
关于Yii2批量更新的操作
电商数仓ODS层-----日志数据装载
[kali-vulnerability exploitation] (3.2) Metasploit basics (on): basic knowledge