Re: setFetchSize() [Viruschecked]

From: Felipe Schnack <felipes(at)ritterdosreis(dot)br>
To: "Patric Bechtel" <bechtel(at)ipcon(dot)de>
Cc: "Dmitry Tkach" <dmitry(at)openratings(dot)com>, "Rich Cullingford" <rculling(at)sysd(dot)com>, "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: setFetchSize() [Viruschecked]
Date: 2003-07-17 17:22:45
Message-ID: 20030717142245.2f6f4195.felipes@ritterdosreis.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

oh, so pgsql is the problem, not the driver?
If I understand what you said well, I just have to turn off autocommit and set fetchsize to any positive number and the driver will do its work, right?

On Thu, 17 Jul 2003 19:11:44 +0200
"Patric Bechtel" <bechtel(at)ipcon(dot)de> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Thu, 17 Jul 2003 13:01:43 -0400, Dmitry Tkach wrote:
>
> Hello Dmitry,
>
> that's exactly what the driver is doing if you do a setFetchSize(10).
> Nevertheless, it won't solve the problem of the server eating HUGE amounts of memory if you do a "declare foo cursor for select * from myhugetable". It seems
> like postgresql locks all rows (or even copies them around in memory) until the connection drops again.
>
> Patric
>
> >Rich Cullingford wrote:
>
> >> All,
> >> Will this function be implemented in Release 7.4? I have several arge
> >> tables that run Java out of memory when I attempt to load them through
> >> JDBC. Any workarounds arppreciated...
>
> >I was using cursors for a while as a workaround...
> >Something like this:
>
> >c.setAutocommit (false);
> >Statement s = c.createStatement ();
> >s.execute ("declare foo cursor for select * from bar");
>
> >while (true)
> >{
> > ResultSet rs = s.executeQuery ("fetch 10 from foo");
> > int count = 0;
> > while (rs.next ())
> > {
> > count++;
> > doStuffWithThisRow (rs);
> > }
> >
> > if (count < 10) //The whole cursor contents has been processed
> > break;
> >}
> >
> >
> >I hope, it helps...
>
> >Dima
>
>
>
> >---------------------------(end of broadcast)---------------------------
> >TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>
>
>
>
> PGP Public Key Fingerprint: 2636 F26E F523 7D62 4377 D206 7C68 06BB
>
> -----BEGIN PGP SIGNATURE-----
> Version: PGPsdk version 1.7.1 (C) 1997-1999 Network Associates, Inc. and its affiliated companies.
>
> iQA/AwUBPxbKwXxoBrvMu8qQEQKC8gCfWN0mM5HfiheSggCracN3JPglHckAn0KI
> G5m+Vo0NZQ9l53pE44U9EpyK
> =udRs
> -----END PGP SIGNATURE-----
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend

--

/~\ The ASCII Felipe Schnack (felipes(at)ritterdosreis(dot)br)
\ / Ribbon Campaign Analista de Sistemas
X Against HTML Cel.: 51-91287530
/ \ Email! Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
ritter(at)ritterdosreis(dot)br
Fone: 51-32303341

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dmitry Tkach 2003-07-17 17:25:56 Re: setFetchSize()
Previous Message Dmitry Tkach 2003-07-17 17:20:49 Re: setFetchSize() [Viruschecked]