Re: setFetchSize question

From: Kris Jurka <books(at)ejurka(dot)com>
To: Alan Stange <stange(at)rentec(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org, dave(dot)smith(at)candata(dot)com
Subject: Re: setFetchSize question
Date: 2005-02-25 19:05:56
Message-ID: Pine.BSO.4.56.0502251401280.5243@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2005-02-25 19:11:29 Re: Statement level transactions
Previous Message Tom Lane 2005-02-25 18:28:06 Re: [JDBC] Where are we on stored procedures?