Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PostgreSQL JDBC FLOAT8 transmitted as String

While profiling loading of large dataset from Postgres 9.3.5 with latest JDBC drivers (9.4-1201-jdbc41), I noticed that lots of time is spent inside AbstractJdbc2ResultSet.getDouble() method, where the driver is converting a String value to double using Double.toDouble().

Looking at the source code, seems like there is a way to transmit double values in binary format, but I could not find any way to force server to send back binary encoded double values (tried setting binaryTransfer to true in the connection string as suggested in https://wiki.postgresql.org/wiki/JDBC-BinaryTransfer, did not change anything).

Did anybody encounter similar behaviour while loading data from Postgres, or has any insight on why is this implemented this way? I found recent discussion of similar question in here http://www.postgresql.org/message-id/flat/[email protected]#[email protected]), but there were no conclusive answers provided there.

like image 718
Altair7852 Avatar asked Aug 06 '26 11:08

Altair7852


1 Answers

You need to execute the statement at least 5-6 (or maybe more) to get binaryTransfer mode. More at: https://github.com/pgjdbc/pgjdbc/issues/642

like image 163
foror Avatar answered Aug 08 '26 23:08

foror



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!