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

From: Jorge Solórzano <jorsol(at)gmail(dot)com>
To: Leonid Mikhailov <lmikhailov(at)esri(dot)com>
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: how to make PostgreSQL JDBC driver transfer data as binary rather than as a string
Date: 2019-03-28 12:37:45
Message-ID: CA+cVU8McbH8w4GAGcHF4jdsXrwGUhO8izZ7u9F0BraBfqKC_=Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi, Leonid.

BYTEA should already be transferred in binary[1].

[1] https://github.com/pgjdbc/pgjdbc/blob/ed5f750beb387a8846e5aa79a775e2d49b48b3c4/pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java#L300

On Thu, Mar 28, 2019 at 1:19 PM Leonid Mikhailov <lmikhailov(at)esri(dot)com> wrote:
>
> 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://jdbc.postgresql.org/documentation/head/connect.html) 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
>
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Eric J. Van der Velden 2019-03-28 19:37:19 Unrecognized parameter: max_prepared_foreign_transactions
Previous Message Leonid Mikhailov 2019-03-28 00:05:56 how to make PostgreSQL JDBC driver transfer data as binary rather than as a string