简体   繁体   中英

How to get data from Oracle table into java application concurrently

I have an Oracle table with ~10 million records that are not dependent on each other. An existing Java application executes the query an iterates through the returned Iterator batching the records for further processing. The fetchSize is set to 250.

Is there any way to parallelize getting the data from the Oracle DB? One thing that comes to mind is to break down the query into chunks using "rowid" and then pass these chunks to separate threads.

I am wondering if there is some kind of standard approach in solving this issue.

Few approaches to achieve it:

  1. alter session force parallel QUERY parallel 32; execute this at DB level in PL/SQL code just before the execution of SELECT statement. You can adjust the 32 value depends on number of Nodes (RAC setup).

  2. The approach which you are doing on the basis of ROWID but the difficult part is how you return the chunk of SELECT queries to JAVA and how you can combine that result. So this approach is bit difficult.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM