getFastLong gets longs slowly - Mailing list pgsql-jdbc

From Joshua Engel
Subject getFastLong gets longs slowly
Date
Msg-id CADs656r451+12EsC0ZeXzt08D9kfw7QCW=eLKuuA0vZNB8HFvQ@mail.gmail.com
Whole thread Raw
Responses Re: getFastLong gets longs slowly  (Mikko Tiihonen <Mikko.Tiihonen@nitorcreations.com>)
List pgsql-jdbc
I tracked down a performance problem to the JDBC driver's getFastLong function.

For very large long values (in particular, Long.MAX_VALUE and MIN_VALUE), a special case in getFastLong throws an exception (FAST_NUMBER_FAILED) because it's 19 digits rather than 18. It's then caught and reprocessed using the regular long processing code (mostly, deferring to Long.getLong).

In the JVMs I'm using (JDK 6 and 7), the delay introduced by that exception is substantial. It's not large on a per-instance basis but I'm sorting through a great many records, many of which are MAX_VALUE. Several different performance measurement tools all put the blame right there.

I compiled the code myself with larger values for that cutoff, and get a huge performance increase.

So... is there a way I can check that change in?

And incidentally, while I'm at it... is there any reason it's storing my long values as binary coded decimal? Can I get it to stop doing that? The whole point of using a long rather than a string value was presumably to have it work faster.

Thanks,
Joshua Engel

pgsql-jdbc by date:

Previous
From: Christophe Canovas
Date:
Subject: bad performances since 9.1 version
Next
From: Mikko Tiihonen
Date:
Subject: Re: getFastLong gets longs slowly