Re: binary protocol was Performance problem with timestamps in result sets

From: Marc Herbert <Marc(dot)Herbert(at)continuent(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: binary protocol was Performance problem with timestamps in result sets
Date: 2006-03-10 15:42:49
Message-ID: khjirqm5mrq.fsf@meije.emic.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

"Thomas Dudziak" <tomdzk(at)gmail(dot)com> writes:

> On 3/9/06, mikael-aronsson <mikael-aronsson(at)telia(dot)com> wrote:
>> How about the actual transport cost difference between text and binary
>> protocols ? it may not be any big difference though, and many times text
>> representation can be smaller then a binary protocol.
>
> Really ? I would have thought its vice versa. E.g. a float is usualy 4
> (or 8) bytes in binary, but can be a lot longer in text depending on
> the format.

To represent binary IEEE754's floats (4 bytes) without loss the
maximum required number of base10 digits is 9. For IEEE754's doubles
(8 bytes) it's 17. I don't know what is the "average" required number
of digits.

Of course using one byte-character per base10 digit is a waste of
space... you could gzip or BCD-encode the string :-)

References:
- "What Every Computer Scientist Should Know About Floating Point
Arithmetic" 1991 - David Goldberg
- paragraph "Conversions" at:
<http://www2.hursley.ibm.com/decimal/>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Marc Herbert 2006-03-10 15:49:44 Re: binary protocol was Performance problem with timestamps in result sets
Previous Message Markus Schaber 2006-03-10 09:58:06 Re: binary protocol was Performance problem with timestamps