java - Using JPA cursor takes more time during data pulling and at the end OutOfMemory exception occured -


suppose have database (postgres) 12 million row. want data page size 30k using jpa cursor. during first request consume more time. here query hints:

query.sethint(queryhints.cursor, true)              .sethint(queryhints.scrollable_cursor, true)              .sethint("eclipselink.read-only", "true")              .sethint(queryhints.cursor_initial_size, 30000)              .sethint(queryhints.cursor_page_size, 30000); 

now when calling using

cursor = (cursoredstream) query.getsingleresult(); list = cursor.next(math.min((rangecount - o), pagesize)); 

it consumes 236 sec executing first line (executing query).

my persistent.xml configuration cursor given below,

<property name="eclipselink.persistence-context.close-on-commit" value="true" />   <property name="eclipselink.persistence-context.flush-mode" value="commit" />   <property name="eclipselink.jdbc.cache-statements" value="true" />   <property name="eclipselink.logging.level" value="off" />   <property name="eclipselink.cache.shared.default" value="false"/> 

can me, how reduce time , overcome outofmemory exception?

thanks.

do outofmemory exception when executing first query ? if answer no, maybe problem forgot close() cursor after each query free resources.

java have been , use lot of memory. however, in opinion, since server-side code, should executed in remote machine 4gb or more ram, not in regular computer. when dealing millions of rows.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -