Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 624F11337B34 for ; Fri, 17 Dec 2010 09:51:35 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 34015-03 for ; Fri, 17 Dec 2010 13:51:28 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from rome.boulder.noaa.gov (rome.boulder.noaa.gov [140.172.10.146]) by mail.postgresql.org (Postfix) with ESMTP id DEE311337B2F for ; Fri, 17 Dec 2010 09:51:27 -0400 (AST) Received: from [137.75.201.47] (tripledrop.fsl.noaa.gov [137.75.201.47]) by email.boulder.noaa.gov (iPlanet Messaging Server 5.2 HotFix 2.01 (built Aug 26 2004)) with ESMTPA id <0LDK005JTRTROC@email.boulder.noaa.gov> for pgsql-performance@postgresql.org; Fri, 17 Dec 2010 13:51:27 +0000 (GMT) Date: Fri, 17 Dec 2010 13:51:27 +0000 From: Nick Matheson Subject: Re: Help with bulk read performance In-reply-to: To: Pierre C Cc: Andy Colson , Dan Schaffer , Jim Nasby , pgsql-performance@postgresql.org Message-id: <4D0B6ADF.7050303@noaa.gov> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8; format=flowed Content-transfer-encoding: 7BIT User-Agent: Thunderbird 2.0.0.24 (X11/20101103) References: <4CCECB69.7080906@noaa.gov> <4D078CD7.7030308@squeakycode.net> <4D07928B.2070907@squeakycode.net> <4D0921D2.2030806@noaa.gov> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-4.21 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201012/211 X-Sequence-Number: 41663 Pierre- I agree with your observation of float <-> text conversion costs, but in this case Dan is talking about storing the raw float data (ie: 4 bytes per float) in a bytea array so there is only the conversion from java float[n] to java byte[4*n] which is not nearly as costly as float <-> text conversion (especially if you leave it in architecture byte order). Nick > >> If the data are stored as a byte array but retrieve into a ResultSet, >> the unpacking time goes up by an order of magnitude and the >> observed total throughput is 25 MB/s. If the data are stored in a >> Postgres float array and unpacked into a byte stream, the >> observed throughput is 20 MB/s. > > > float <-> text conversions are very slow, this is in fact due to the > mismatch between base-2 (IEEE754) and base-10 (text) floating point > representation, which needs very very complex calculations.