pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
setFetchSize() not working
3+ messages / 3 participants
[nested] [flat]

* setFetchSize() not working
@ 2004-10-10 14:42 Jeffrey Tenny <jeffrey.tenny@comcast.net>
  2004-10-10 18:25 ` Re: setFetchSize() not working Kris Jurka <books@ejurka.com>
  2004-10-10 20:20 ` Re: setFetchSize() not working Oliver Jowett <oliver@opencloud.com>
  0 siblings, 2 replies; 3+ messages in thread

From: Jeffrey Tenny @ 2004-10-10 14:42 UTC (permalink / raw)
  To: pgsql-jdbc

I'm using the 7.3.3 backend, and the JDBC 8.0dev jdbc driver 
(pgdev.306.jdbc3.jar).

I'm calling PreparedStatement.setFetchSize(32), on a table fetching 32KB 
BYTEA records, and I'm blowing out memory on the executeQuery() call
of the prepared statement.

PreparedStatement.getFetchDirection reports 1000, which is
ResultSet.FETCH_FORWARD.

Any clues?


Here's the trace catching the driver red-handed with all the memory:

SITES BEGIN (ordered by live bytes) Sun Oct 10 09:55:56 2004
           percent         live       alloc'ed  stack class
  rank   self  accum    bytes objs   bytes objs trace name
     1 80.92% 80.92% 55023456  578 80423168 1051 62286 [B

TRACE 62286:
org.postgresql.core.PGStream.Receive(PGStream.java:410)
org.postgresql.core.PGStream.ReceiveTupleV2(PGStream.java:395)
org.postgresql.core.v2.QueryExecutorImpl.processResults(QueryExecutorImpl.java:337)
org.postgresql.core.v2.QueryExecutorImpl.execute(QueryExecutorImpl.java:251)
org.postgresql.core.v2.QueryExecutorImpl.execute(QueryExecutorImpl.java:159)
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:346)
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:294)
org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:209)
org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92)




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: setFetchSize() not working
  2004-10-10 14:42 setFetchSize() not working Jeffrey Tenny <jeffrey.tenny@comcast.net>
@ 2004-10-10 18:25 ` Kris Jurka <books@ejurka.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Kris Jurka @ 2004-10-10 18:25 UTC (permalink / raw)
  To: Jeffrey Tenny <jeffrey.tenny@comcast.net>; +Cc: pgsql-jdbc



On Sun, 10 Oct 2004, Jeffrey Tenny wrote:

> I'm using the 7.3.3 backend, and the JDBC 8.0dev jdbc driver 
> (pgdev.306.jdbc3.jar).
> 
> I'm calling PreparedStatement.setFetchSize(32), on a table fetching 32KB 
> BYTEA records, and I'm blowing out memory on the executeQuery() call
> of the prepared statement.
> 
> PreparedStatement.getFetchDirection reports 1000, which is
> ResultSet.FETCH_FORWARD.
> 
> Any clues?
> 

The development driver has had cursor based fetching support removed when 
connecting to servers older than 7.4.  The 7.4 release had a new 
frontend/backend protocol added which allows for an alternate method of 
streaming ResultSets.  The 7.4 driver used the old method, but 
the development driver was updated to use the new method and in doing that 
support for streaming using the old protocol was removed.  Your options 
seem to be:

 - update your server to 7.4 or later
 - use the 7.4 driver against your 7.3 server
 - figure out had to re-add support for streaming resultsets from old
   servers to the new driver.


Kris Jurka




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: setFetchSize() not working
  2004-10-10 14:42 setFetchSize() not working Jeffrey Tenny <jeffrey.tenny@comcast.net>
@ 2004-10-10 20:20 ` Oliver Jowett <oliver@opencloud.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Oliver Jowett @ 2004-10-10 20:20 UTC (permalink / raw)
  To: Jeffrey Tenny <jeffrey.tenny@comcast.net>; +Cc: pgsql-jdbc

Jeffrey Tenny wrote:
> I'm using the 7.3.3 backend, and the JDBC 8.0dev jdbc driver 
> (pgdev.306.jdbc3.jar).
> 
> I'm calling PreparedStatement.setFetchSize(32), on a table fetching 32KB 
> BYTEA records, and I'm blowing out memory on the executeQuery() call
> of the prepared statement.
> 
> PreparedStatement.getFetchDirection reports 1000, which is
> ResultSet.FETCH_FORWARD.
> 
> Any clues?

Use a newer backend or an older driver. The development driver only 
supports cursors when using a V3 protocol connection (supported from 7.4 
onwards). You probably want a newer backend anyway even if only the 
newest 7.3.x, there are data-loss bugs in earlier 7.3 versions.

There's no real reason that V2 can't use cursors, it's just that the 
support has not been reimplemented for the changed protocol layer framework.

In general all the new driver work is happening against 7.4/8.0 
backends. We do test for correct behaviour against 7.3 servers, but 
there are no guarantees that the driver is going to perform as well.

-O



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2004-10-10 20:20 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-10-10 14:42 setFetchSize() not working Jeffrey Tenny <jeffrey.tenny@comcast.net>
2004-10-10 18:25 ` Kris Jurka <books@ejurka.com>
2004-10-10 20:20 ` Oliver Jowett <oliver@opencloud.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox