Skip site navigation (1) Skip section navigation (2)

Re: Memory exeception

From: Barry Lind <barry(at)xythos(dot)com>
To: Peter Wasem <peter(dot)wasem(at)itag(dot)ch>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Memory exeception
Date: 2001-11-07 18:39:39
Message-ID: 3BE97FEB.70201@xythos.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
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)
> 



In response to

Responses

pgsql-jdbc by date

Next:From: Daniel GermainDate: 2001-11-07 19:00:32
Subject: ResultSet.getDate failure with timestamp column
Previous:From: Barry LindDate: 2001-11-07 18:36:29
Subject: Re: Deleting records with text fields

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group