JDBC-BinaryTransfer

From PostgreSQL wiki
Jump to navigationJump to search

JDBC Binary Transfer

The idea of the binary transfer patch to the JDBC driver is to transfer all binary types from the PostgreSQL server to the JDBC driver in their binary form.

This eliminates the need to convert, for example, a number from their text representation to their binary representation.

This patch will therefore provide a speedup of the JDBC performance.

Configuration

The binary transfer is enabled by default, but is controlled by the

binaryTransfer=boolean

flag on the connection url.

An example:

jdbc:postgresql://localhost:5432:mydatabase?binaryTransfer=true

Furthermore you are able to force binary transfer using the

-Dorg.postgresql.forcebinary=boolean

JVM argument.

An example:

java -Dorg.postgresql.forcebinary=true -classpath myjar.jar MyApp

If the compatible version is less that 8.0 then values of type TIME, TIMETZ, TIMESTAMP and TIMESTAMPTZ are never transferred in binary format.

If the compatible version is less that 8.3 then values of type INT2_ARRAY, INT4_ARRAY, INT8_ARRAY, FLOAT4_ARRAY, FLOAT8_ARRAY, VARCHAR_ARRAY and TEXT_ARRAY are never transferred in binary format.

Development

The patch was developed by Mikko, with modifications by Kris and minor updates by Jesper.

Testing

Versions

v13

  • Sync with CVS HEAD (2009/06/23)

v12

  • Sync with CVS HEAD (2009/06/02)

v11

  • Fixed Statement::executeQuery(String) in regards to ResultSet
  • Added binary transfer to the test suite
  • Added simple Statement ResultSet test

v10

  • Sync with CVS HEAD
  • build.xml - cleanups regarding def_pgport
  • build.properties - cleanups regarding def_pgport
  • QueryExecutor - corrected the constant value
  • QueryExecutorImpl - removed unneeded code paths

v9 and older

Patches