Re: Out of memory error on huge resultset - Mailing list pgsql-jdbc

From Nic Ferrier
Subject Re: Out of memory error on huge resultset
Date
Msg-id 87d6qgzc51.fsf@pooh-sticks-bridge.tapsellferrier.co.uk
Whole thread Raw
In response to Re: Out of memory error on huge resultset  (Nic Ferrier <nferrier@tapsellferrier.co.uk>)
List pgsql-jdbc
Nic Ferrier <nferrier@tapsellferrier.co.uk> writes:

> Basically, I like your solution: use setFetchSize to control when a
> cursor is used.
> 

I decided the quickest short term thing to do was make everything go
through a cursor and see what effect that has.

The default fetch size is 0 and guess what that means to the FETCH
command? That's right: get everything.

So I'm simply transforming querys from:

   SELECT x FROM y WHERE z;


into
   DECLARE jdbcXX CURSOR FOR $query ;    FETCH FORWARD $fetchSize jdbcXX;


I'll then alter the code to deal with the necessary auto-fetching
when the cache gets low.

I think this is a pretty good trade off between what we've got and
the need not to trash the VM with a gazillion row query.


I haven't quite got it working yet, but I've only been hacking for a
couple of hours (and I'm not very quick  /8-).


Nic



pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: Anoter JDBC Error
Next
From: Barry Lind
Date:
Subject: Re: Out of memory error on huge resultset