gpt4 book ai didi

java - SQL 查询模式和相对性能

转载 作者:行者123 更新时间:2023-11-29 09:36:42 26 4
gpt4 key购买 nike

<分区>

考虑一个以主键作为列“id”的表

必须查询 id 范围为 [ 1, 2, 3, 4 ...]

有2个选项-

1)

Select * from Table where id = 1;
Select * from Table where id = 2;
Select * from Table where id = 3;
Select * from Table where id = 4;

2)

Select * from Table where id in ( 1, 2, 3, 4 );

对于 Oracle as Databse 和使用 Spring JDBC Template 进行持久化,这两者中哪一个在性能上更好。从应用程序的角度抛开内存限制,假设数据集 1、2、3、4 将在 Java 数据结构的限制范围内。

它使用数据库连接池。

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com