[英]How can I query multiple related tables, without a join, and get consistent data using JDBC?
I am creating a process that connects to a given SQL Server database via JDBC, scans every table, and reads any new data that has been inserted or updated since the last run of this process. 我正在创建一个通过JDBC连接到给定SQL Server数据库,扫描每个表并读取自该过程的上次运行以来已插入或更新的任何新数据的过程。 The owner of the database will not allow this process to do joins on any of the tables due to performance concerns.
由于性能方面的考虑,数据库的所有者不允许此过程对任何表进行联接。
The scenario in question 有关方案
How can I query multiple related tables, without a join, and get consistent data using JDBC? 如何在没有联接的情况下查询多个相关表,并使用JDBC获得一致的数据?
If you cannot do JOINs, you probably then just have to keep track of each retrieved primary key of each parent table and then use those for querying the child rows. 如果您不能执行JOIN,则可能只需要跟踪每个父表的每个检索到的主键,然后使用那些键来查询子行。 It will complexify the queries, and add more strain to the DB, as you're executing more queries vs doing it in a single JOINed query, but it should give the same results.
与在单个JOINed查询中执行更多查询相比,这将使查询复杂化,并给数据库增加更多压力,但是它应该给出相同的结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.