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

Re: Workarounds for getBinaryStream returning ByteArrayInputStream on bytea

From: Kris Jurka <books(at)ejurka(dot)com>
To: Radosław Smogura <rsmogura(at)softperience(dot)eu>
Cc: Александър Шопов <lists(at)kambanaria(dot)org>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Workarounds for getBinaryStream returning ByteArrayInputStream on bytea
Date: 2010-11-26 15:25:01
Message-ID: alpine.BSO.2.00.1011261019010.21699@leary.csoft.net (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-jdbc

On Fri, 26 Nov 2010, Rados?aw Smogura wrote:

> I would like to send few files for getBinaryStream(). So this will work
> much like stream and will don't eat so much heap. I don't copy source
> this_row[i] array, so I don't know how this will do with concur updates,
> (original method doesn't make this when column is not bytea, too). I left
> few comments if we should throw exception on broken streams in 8.4, or just
> silence notify EOF.

The problem is that the whole bytea is still in this_row[i].  The value 
isn't being streamed from the server.  So yes, you are saving a copy of 
the value which does save heap space, but that won't really help the 
described problem where many large bytea values are fetched because the 
driver will have read and stored them all prior to getBinaryStream being 
called.

Kris Jurka

In response to

Responses

pgsql-hackers by date

Next:From: Robert HaasDate: 2010-11-26 15:28:38
Subject: Re: Assertion failure on hot standby
Previous:From: Alvaro HerreraDate: 2010-11-26 14:52:30
Subject: Re: duplicate connection failure messages

pgsql-jdbc by date

Next:From: Radosław SmoguraDate: 2010-11-26 16:20:47
Subject: Re: Workarounds for getBinaryStream returning ByteArrayInputStream on bytea
Previous:From: Radosław SmoguraDate: 2010-11-26 12:05:30
Subject: Re: Workarounds for getBinaryStream returning ByteArrayInputStream on bytea

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