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

Re: Driver memory usage on select and autocommit

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Silvio Bierman <sbierman(at)jambo-software(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Driver memory usage on select and autocommit
Date: 2008-10-29 11:33:05
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
Silvio Bierman wrote:
> Can anyone explain why the PostgreSQL JDBC driver caches the result of a 
> select statement in memory even though I have set a fetch size. Only 
> setting autocommit to off will prevent this but that seems very 
> counterintuitive.
> Any explanations?

Incremental retrieval of results relies on using a v3 protocol portal 
(similar to a cursor). These portals are implicitly closed at the end of 
a transaction; that includes the end of the implicit transaction created 
for each statement when autocommit is on. So you have to have a 
long-lived transaction for incremental retrieval to be useful, i.e. 
autocommit must be off.


In response to

pgsql-jdbc by date

Next:From: Kris JurkaDate: 2008-10-29 17:54:23
Subject: Re: Re: Connection hanging on INSERT apparently due to large batch size and 4 CPU cores
Previous:From: Silvio BiermanDate: 2008-10-29 09:16:49
Subject: Driver memory usage on select and autocommit

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