Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aKt67-0007i4-Sj for pgsql-sql@arkaria.postgresql.org; Sun, 17 Jan 2016 19:34:47 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aKt67-0005pB-Fd for pgsql-sql@arkaria.postgresql.org; Sun, 17 Jan 2016 19:34:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aKt57-0003gk-Nx for pgsql-sql@postgresql.org; Sun, 17 Jan 2016 19:33:45 +0000 Received: from nm43-vm5.bullet.mail.bf1.yahoo.com ([216.109.114.236]) by magus.postgresql.org with esmtps (TLS1.0:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1aKt53-0002Si-R4 for pgsql-sql@postgresql.org; Sun, 17 Jan 2016 19:33:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ymail.com; s=s2048; t=1453059219; bh=jEKa7G/cSPmIDCoGgFJ9fwSFT4tHD8sWJnExrur/Opg=; h=Date:From:Reply-To:To:Subject:References:From:Subject; b=hdNWb78DvIdZUzwLvBiIvGlYp0fAP1EasfRCYMCWhKxmXvgQYxTpj89SQBJLB/ZXu0zyzuhATsSItVMu5YMfQmsaTAKqdSF8yHBCcz6J/ZDA2W+c6orAgMUi/Z+dzj5Ggf/9IGdKLy49fkFSV5NnSbZHnTdgrlHG9hmFOa4VULIJ7A28wC8lskIEPu6GBp6OGwKJcvolB9OBuo8yU/tP5Ka97lTQNgGRj2xS2/i9mQbFo4uDNHNkXUgSos3YZ10KE35q+ev14yTswZdWllNXismLu+YaBqif449dqJTo+BtfSqIPApvfRWZjKyVXfhJPO7SQYQhup8bnowQ4JC5Ihw== Received: from [66.196.81.171] by nm43.bullet.mail.bf1.yahoo.com with NNFMP; 17 Jan 2016 19:33:39 -0000 Received: from [98.139.215.254] by tm17.bullet.mail.bf1.yahoo.com with NNFMP; 17 Jan 2016 19:33:39 -0000 Received: from [127.0.0.1] by omp1067.mail.bf1.yahoo.com with NNFMP; 17 Jan 2016 19:33:39 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 494679.41705.bm@omp1067.mail.bf1.yahoo.com X-YMail-OSG: 8WJgyRUVM1nzaaRYH7.AZTTYmNPbhUlaro326_liM_w60p9cmJ2EpzDGiqUzh43 ERVHPMYrj8vKdkpBACehtYF4.OrtbrXgV4s6.PYcDELTpfp95lQM72qpHRnHCGcxGhtG8HGTwElE dOFBF4bkOAjkuwLsSxLzqHY0UmJn9kt9A4bY6z.2BXH4ESLQek83P60Eujmx6ZwHF3Ji7hp_kimt iNyJokdNJwvlecg.lIfxq3v9PeE.Gi8qJoETwHkukRgy.F8TFk0r6WSZfNWRy2.tlzrPkU6AxyK4 ebTQVvsO_M3V6fEK7u5Wwz8_xD.SyiLP0o5EsE69wEa57qkr0JBaN.B202viJgfPqdBGwxPMiXIB CREHjHjIEx8m3YIcMjoHlV3ebdh9IU_rzLd8hsx8DWIV3JU75i9PuIefhdjfMFFGI.jr7UPI3gyM nlBRrpXgEwkKDanRef4Q4lUiIh.LIZpbiDPn0R7BEOasvNFocHu.RfhBAUulzCXPrdAOhgPRAJAN uIlTkBwD5Rc2_2bJM50qYDbto7o2Ky4HTfw-- Received: by 76.13.27.69; Sun, 17 Jan 2016 19:33:39 +0000 Date: Sun, 17 Jan 2016 19:33:38 +0000 (UTC) From: Eugene Yin Reply-To: Eugene Yin To: Postgres List Message-ID: <194527298.6807703.1453059218766.JavaMail.yahoo@mail.yahoo.com> Subject: BYTEA MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_6807702_1473268751.1453059218762" References: <194527298.6807703.1453059218766.JavaMail.yahoo.ref@mail.yahoo.com> Content-Length: 5544 X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org ------=_Part_6807702_1473268751.1453059218762 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Pg 9.4+ Storing binary data using bytea or text data types =20 - Pluses =20 - Storing and Accessing entry utilizes the same interface when acces= sing any other data type or record.=20 - No need to track OID of a "large object" you create - Minus=20 =20 - bytea and text data type both use TOAST (details here) =20 - limited to 1G per entry=20 - 4 Billion (> 2KB) entries per table max. - Need to escape/encode binary data before sending to DB then do the re= verse after retrieving the data=20 - Memory requirements on the server can be steep even on a small record= set.=C2=A0 https://wiki.postgresql.org/wiki/BinaryFilesInDB Do I =C2=A0really=C2=A0Need to escape/encode binary data before sending to = DB then do the reverse after retrieving the data? If so, what (Java) codes should I use=C2=A0to achieve this goal (I am using= the Java to interface with the DB)? Thanks Eugene ------=_Part_6807702_1473268751.1453059218762 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Pg = 9.4+

Storing binary data using bytea or text d= ata types
  • Pluses
    • Storing and Accessing entry utilizes th= e same interface when accessing any other data type or record.=20
    • No need to tra= ck OID of a "large object" you create
  • Minus=20
    • bytea and text data ty= pe both use TOAST (details here)
      • limited to 1G per entry=20
      • 4 Billion (>= ; 2KB) entries per table max.
    • Need to escape/encode binary data before sendi= ng to DB then do the reverse after retrieving the data=20
    • Memory req= uirements on the server can be steep even on a small record set. 
    • =



Do I &nbs= p;really Need to escape/encode binary data be= fore sending to DB then do the reverse after retrieving the data?
= If so, what (Java) codes should I use to achieve this goal (I am using= the Java to interface with the DB)?



Th= anks

Eugene
------=_Part_6807702_1473268751.1453059218762--