how to make PostgreSQL JDBC driver transfer data as binary rather than as a string

From: Leonid Mikhailov <lmikhailov(at)esri(dot)com>
To: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: how to make PostgreSQL JDBC driver transfer data as binary rather than as a string
Date: 2019-03-28 00:05:56
Message-ID: 932AB9BB-E80B-41BF-A3F3-EDD4B48D487F@esri.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hello,

During performance testing of our application we have noticed that the amount of data being transferred from PostgreSQL database to the application when fetching content of a BYTEA field is twice the size of the data stored in this field. Once received the volume of the data is exactly the same as stored. It seems that it happens because the data is transferred as a string rather than as a binary. According to the doc (https://urldefense.proofpoint.com/v2/url?u=https-3A__jdbc.postgresql.org_documentation_head_connect.html&d=DwIGaQ&c=n6-cguzQvX_tUIrZOS_4Og&r=WT4i-nfl1Vie9EODivOyuz_kGVypWTnlujpaXsPsTT8&m=ncaYPnn789GPTMLh_9mpWLXGE7elVAzWXoUbaccpqWQ&s=yjv-P7riqQ72H1Uqdd7Wr1o5u2dW7JtT5TXab8txNzo&e=) it should be possible to tell JDBC driver to use binary protocol by appending binaryTransferEnable = BYTEA to the end of the JDBC connection URL, like this:

jdbc:postgresql://<servername>:7654/<databaseName>?binaryTransferEnable=BYTEA
Unfortunately it doesn’t seem to make any difference. Are we doing something incorrectly?

Thanks,
Leonid

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Jorge Solórzano 2019-03-28 12:37:45 Re: how to make PostgreSQL JDBC driver transfer data as binary rather than as a string
Previous Message Dave Cramer 2019-03-20 14:52:52 [pgjdbc/pgjdbc] ed5f75: Update checkstyle to 8.18 (#1447)