Re: setFetchSize question - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: setFetchSize question
Date
Msg-id Pine.BSO.4.56.0502251401280.5243@leary.csoft.net
Whole thread Raw
In response to setFetchSize question  (Alan Stange <stange@rentec.com>)
List pgsql-jdbc

On Fri, 25 Feb 2005, Alan Stange wrote:

> conn.setAutoCommit(false);
> st.setFetchDirection(ResultSet.FETCH_FORWARD);
> st.setFetchSize(1000);
> st.executeQuery("select * from foo");
>
> which would result in queries to the postgresql server like this:
>
> DECLARE JDBC_CURS_588 CURSOR FOR select * from foo; fetch forward 1000
> from JDBC_CURS_588;
>
> In the 8.0 driver I don't see this happening.   I see only the "select *
> from foo" query in the postgresql server log.
>
> Is the query result still being sent in batch chunks of 1000 rows, but
> using a different mechanism?
>

Yes, it is still being sent in batches, but it uses the V3 protocol
ability to partially execute portals.  An Execute message takes a
maximum number of rows to return parameter, which is the fetch size.
Debugging what the driver is actually doing can be done by adding
?loglevel=2 to the URL which will log all the frontend/backend messages
sent/received.

Kris Jurka

pgsql-jdbc by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Where are we on stored procedures?
Next
From: Kris Jurka
Date:
Subject: Re: Statement level transactions