pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Mikko T. <mtiihone@cc.hut.fi>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: OutOfMemory when inserting stream of unknown length
Date: Fri, 20 Aug 2004 21:59:11 +1200
Message-ID: <4125CB6F.5040003@opencloud.com> (raw)
In-Reply-To: <4125C871.1070608@opencloud.com>
References: <Pine.OSF.4.60.0408191028070.368856@kosh.hut.fi>
	<41251B4C.9020205@opencloud.com>
	<Pine.OSF.4.60.0408201155140.368856@kosh.hut.fi>
	<4125C871.1070608@opencloud.com>

Oliver Jowett wrote:
> Mikko T. wrote:
> 
>> But now the current implementation forces the user of the 
>> setBinaryStream to buffer all bytes to memory just to know how many 
>> bytes the stream will actually hold. And after that it can already 
>> call setBytes thus making the whole setBinaryStream useless when the 
>> stream length is not known beforehand.
> 
> 
> Not true -- consider the case where you know the length but the data is 
> held out of heap (for example, a large NIO buffer or a file on disk).

Eh, sorry, I misread your last sentence. Certainly if you don't know the 
length then you have to buffer internally and setBinaryStream() is of no 
use.

The common case I've seen so far on the list is inserting from a file. 
It seems much less common to not know the length of your stream ahead of 
time..

-O



view thread (7+ messages)  latest in thread

Message-ID: <4125CB6F.5040003@opencloud.com>
Permalink:  ../4125CB6F.5040003@opencloud.com/
Also on:    postgresql.org/message-id/4125CB6F.5040003@opencloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: oliver@opencloud.com, mtiihone@cc.hut.fi
  Subject: Re: OutOfMemory when inserting stream of unknown length
  In-Reply-To: <4125CB6F.5040003@opencloud.com>
  References: <Pine.OSF.4.60.0408191028070.368856@kosh.hut.fi> <41251B4C.9020205@opencloud.com> <Pine.OSF.4.60.0408201155140.368856@kosh.hut.fi> <4125C871.1070608@opencloud.com> <4125CB6F.5040003@opencloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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