Re: Out of memory error on huge resultset

From: Nic Ferrier <nferrier(at)tapsellferrier(dot)co(dot)uk>
To: Dave Cramer <Dave(at)micro-automation(dot)net>pgsql-jdbc <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Out of memory error on huge resultset
Date: 2002-10-12 01:20:10
Message-ID: 87d6qgzc51.fsf@pooh-sticks-bridge.tapsellferrier.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Nic Ferrier <nferrier(at)tapsellferrier(dot)co(dot)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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Jeff Davis 2002-10-12 02:08:18 Re: MySQL vs PostgreSQL.
Previous Message Nic Ferrier 2002-10-11 23:14:47 Re: Out of memory error on huge resultset