Re: ResultSet memory usage - Mailing list pgsql-jdbc

From Barry Lind
Subject Re: ResultSet memory usage
Date
Msg-id 3C3F2634.5030708@xythos.com
Whole thread Raw
In response to Re: ResultSet memory usage  ("Dave Cramer" <Dave@micro-automation.net>)
List pgsql-jdbc
 > Couldn't that still be implemented in the JDBC driver by reading from
 > the socket a little at a time? Or would that introduce bigger problems,
 > like catastrophic slowdown of other connections to the backend?

It can't.  Consider the following example:

ResultSet l_rset1 = l_stmt1.executeQuery("select a from foo");
while (l_rset1.next()) {
   ResultSet l_rset2 = l_stmt2.executeQuery("select b from bar where a =
" + l_rset1.getInt(1));
   while (l_rset2.next()) {
     //do something useful
   }
}

This example shows that you need to be able to use the socket to execute
other queries while you are still fetching from the first.  Doing what
you suggest would break many applications that use jdbc.

thanks,
--Barry


Timo Savola wrote:

>>Unfortunately this is an artifact of the way the backend works, once the
>>request is made the backend is going to give us all the data.
>>
>
> Couldn't that still be implemented in the JDBC driver by reading from
> the socket a little at a time? Or would that introduce bigger problems,
> like catastrophic slowdown of other connections to the backend?
>
> Timo
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
>



pgsql-jdbc by date:

Previous
From: Barry Lind
Date:
Subject: Re: LISTEN/NOTIFY support in JDBC driver?
Next
From: Benjamin.Feinstein@guardent.com
Date:
Subject: LISTEN/NOTIFY support?