agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Andreas Joseph Krogh <andreas@visena.com>
To: pgsql-sql@postgresql.org
Subject: Re: BYTEA
Date: Mon, 18 Jan 2016 16:50:09 +0100 (CET)
Message-ID: <VisenaEmail.ca.3430189fb000a7e8.152556785e6@tc7-visena> (raw)
In-Reply-To: <1592189786.7265044.1453131627096.JavaMail.yahoo@mail.yahoo.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>
På mandag 18. januar 2016 kl. 16:40:26, skrev Eugene Yin <eugeneymail@ymail.com
<mailto:eugeneymail@ymail.com>>:
"if you only work with small-ish binary data, yes - BYTEA does the job."
--The goal is to save/retrieve the user's photos (JPEG, TIFF, GIF) and PDF
files. The size of each file is less than
5 MB. For such purpose, is BYTEA ok? If not, then how about 1 MB each?
Again, that depends. If you plan on having 1000 simultaneous users then having
everything in memory might not be a good idea. Remember the memory consumed by
the JVM is quite a lot more the the raw byte-size of each image/blob.
"whole byte-array is kept in memory, both in the JAVA-app and in PG"
--I believe in Java the GarbageCollector will clean it up (?). "Who" will
then clean up the Pg side?
It will clean it up, if it's not referenced anymore. PG will clean up its side
at the end of the transaction (at least).
"whole byte-array is kept in memory, both in the JAVA-app and in PG"
--Does that mean for the OID, byte-array is NOT kept in memory (of JAVA-app or
PG)? If so, where is it kept? And how they are got cleaned up?
As reading BLOBs (using the OID-type) really means your processing a stream of
bytes it's really up to you to decide the size of the byte-buffer you want to
use. Only this byte-buffer is kept in memory (and is freed by the GC when not
referenced anymore), which often is much less than the whole BLOB.
-- Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
andreas@visena.com <mailto:andreas@visena.com>
www.visena.com <https://www.visena.com;
<https://www.visena.com;
view thread (17+ messages) latest in thread
Message-ID: <VisenaEmail.ca.3430189fb000a7e8.152556785e6@tc7-visena>
Permalink: ../VisenaEmail.ca.3430189fb000a7e8.152556785e6@tc7-visena/
Also on: postgresql.org/message-id/VisenaEmail.ca.3430189fb000a7e8.152556785e6@tc7-visena
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: andreas@visena.com
Subject: Re: BYTEA
In-Reply-To: <VisenaEmail.ca.3430189fb000a7e8.152556785e6@tc7-visena>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox