Martin Kal�n wrote:
Postgres (for example) don't use cursors on default. The PG jdbc driver loads the entire ResultSet all at once and keeps it in memory! So, even if you do a getIteratorByQuery the memory load on a large resultset is huge!

You can get around this, if you set the fetchsize on the jdbc statement
for example:
           stmt = con.createStatement();
           stmt.setFetchSize(1);
           ResultSet rs = stmt.executeQuery(sql);

This actually forces the jdbc driver to use a cursor and browse the resultset one by one.

There was no regression when running the test suite with fetch size=1 (and it actually ran a tiny bit faster, presumably because of less JVM allocations for objects not used in the tests).

I will re-run again and check peak JVM heap usage before/after and
bring it up on the development list.

Do you see any drawbacks of an OJB-global default of fetchSize=1
for PostgreSQL?

(This should not affect OJB proxy-prefetching-limit since that prefecthing
is done one layer above the PostgreSQL JDBC level.)

Regards,
 Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to