| From: | Peter Wasem <peter(dot)wasem(at)itag(dot)ch> | 
|---|---|
| To: | Barry Lind <barry(at)xythos(dot)com> | 
| Cc: | pgsql-jdbc(at)postgresql(dot)org | 
| Subject: | Re: Memory exeception | 
| Date: | 2001-11-08 08:19:16 | 
| Message-ID: | 3BEA4004.A015A242@itag.ch | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-jdbc | 
Hi Barry
This is exactly what I observed. The physical memory dropped down to almost
zero (but no swap was used) before the exception was thrown. I'm not sure if I
can use cursors (other than ResultSet) since my application is Java-based.
Thanks
Barry Lind wrote:
> Peter,
>
> Postgres will return the entire result into memory first before
> processing the first row of data.  If you don't want this behavior you
> should use explicit cursors and fetch statements to get data a few rows
> at a time.  See the postgres documentation on the 'cursor' and 'fetch'
> sql statements.
>
> thanks,
> --Barry
>
> Peter Wasem wrote:
>
> > Hi
> >
> > I have a problem in processing large numbers of rows in ResultSets.
> > Here's the code fragment where the problem occurs:
> >
> > ...
> >     ResultSet rset = stmt.executeQuery( "select ... from ... where ...
> > order by ..." ) ;
> >     while(rset.next() )
> >     { // Process the row }
> > ...
> >
> > The query addresses some 100'000 rows. When stmt.executeQuery() is
> > executed suddenly an exception occurs.
> > The same program works fine with other JDBC drivers.
> >
> > Any ideas ?
> >
> > Greetings
> > Peter
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 2: you can get off all lists at once with the unregister command
> >     (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
> >
| Attachment | Content-Type | Size | 
|---|---|---|
| peter.wasem.vcf | text/x-vcard | 238 bytes | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Antonio Fiol Bonnín | 2001-11-08 12:31:10 | Storing a tree | 
| Previous Message | Barry Lind | 2001-11-08 04:26:49 | Re: MD5-based passwords |