X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7C0969DC80E for ; Fri, 10 Mar 2006 11:41:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89593-07 for ; Fri, 10 Mar 2006 11:41:57 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 228579DCA5E for ; Fri, 10 Mar 2006 11:41:51 -0400 (AST) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by svr4.postgresql.org (Postfix) with ESMTP id DABF45AF0BB for ; Fri, 10 Mar 2006 15:41:56 +0000 (GMT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1FHjjt-0008N6-IB for pgsql-jdbc@postgresql.org; Fri, 10 Mar 2006 16:41:13 +0100 Received: from 83.145.96.118 ([83.145.96.118]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 10 Mar 2006 16:41:13 +0100 Received: from Marc.Herbert by 83.145.96.118 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 10 Mar 2006 16:41:13 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-jdbc@postgresql.org From: Marc Herbert Subject: Re: binary protocol was Performance problem with timestamps in result sets Date: Fri, 10 Mar 2006 16:42:49 +0100 Lines: 26 Message-ID: References: <00cc01c64376$7661ca40$c29c143e@w128mtec> <224f32340603091605x59673fdt9a8d69b4f5512c22@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 83.145.96.118 User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4 (Jumbo Shrimp, linux) Cancel-Lock: sha1:lCM5gmm/DTNQ4FjFhv16xQ2wQhA= X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.348 required=5 tests=[AWL=0.095, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.348 X-Spam-Level: * X-Archive-Number: 200603/53 X-Sequence-Number: 14834 "Thomas Dudziak" writes: > On 3/9/06, mikael-aronsson 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: