java - Split the JDBC Oracle Resultset to avoid OOM error -
i have program connects through jdbc oracle database , extracts 3+ million records. if load memory getting out of memory error. want load data memory parts of 50000.
there 2 ways approaching issue: a) keep connection open , process data groups of 50 0000 come result set. not approach because there risk of leaving connection open when done , connection open long time (risking timeouts , decreasing connections pool) each group of 50 000 records being processed (and being processed mean each of these cause other connections open , close based on derived data may needed) b) process based on row numbers not sure impact might if underplaying data changes , cannot afford sort every time process 50 000 records.
this seems common problem , know industry standards/ best approaches/ design patterns issue.
if need durable transaction spans entire read (aka no 1 changing data out under you, allude to), might want investigate moving problem rdbms, , coding stored procedure can call jdbc/jpa/whatever.
i know doesn't solve java side, moving problem proper solution, depending on context , details.
cheers
Comments
Post a Comment