X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 59711528D9 for ; Fri, 17 Jun 2005 16:12:59 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00737-07 for ; Fri, 17 Jun 2005 19:12:54 +0000 (GMT) Received: from hogranch.com (hogranch.com [66.117.128.240]) by svr1.postgresql.org (Postfix) with ESMTP id 397A6528C6 for ; Fri, 17 Jun 2005 16:12:53 -0300 (ADT) Received: from [192.168.0.2] (porker [192.168.0.2]) by hogranch.com (8.11.6/8.11.6) with ESMTP id j5HJCjs05713; Fri, 17 Jun 2005 12:12:45 -0700 Message-ID: <42B320AD.5020709@hogranch.com> Date: Fri, 17 Jun 2005 12:12:45 -0700 From: John R Pierce User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Javier Cc: pgsql-jdbc@postgresql.org Subject: Re: JDBC compressed stream References: <6.2.1.2.2.20050617171434.03f31ad8@pop3.terra.es> In-Reply-To: <6.2.1.2.2.20050617171434.03f31ad8@pop3.terra.es> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-HawgScanner-Information: Please contact the ISP for more information X-HawgScanner: Found to be clean X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200506/96 X-Sequence-Number: 13058 Javier wrote: > > Hi, I'm developing a java client application that uses JDBC to access > a PostGIS/PostgreSQL database. I'm working with PostgreSQL JDBC driver > Type 4 (http://jdbc.postgresql.org/) and I need to compress the output > streamdata from database queries. > > The problem can't be resolved making a better WHERE clause, because I > have to received a great amount of GIS information, and this info can be > highly compressed. Moreover, this data can't be stored compressed in the > database, so, an external compressor is needed. > > Anybody can explain me if it is possible to compress a JDBC datastream > ??? Is this a PostgreSQL JDBC driver issue??? or a new function must be > added to PostgreSQL??? > > Last question --> Anyone knows any other way to achieve compression > with other kind of solution??? you could add a C function to the Postgres server engine which provides the compression on a field by field basis, then have a corresponding Java function to decompress the results after you recieve them. You would use this function on a select statement something like... SELECT field1, fieldcompress(field2) AS field2, fieldcompress(field3) AS field3 FROM tablename WHERE ...; These sorts of user C functions can be added to the database server at runtime, you compile the C to a .so shared object file (.DLL on Windows), and load it into the database server with a CREATE FUNCTION statement. See http://www.postgresql.org/docs/8.0/static/xfunc-c.html for how you develop, install, and use these sorts of functions. otherwise, AFAIK, you'd have to design a new compressed data protocol for pgsql, implement it in the postgres postmaster, and implement it in the jdbc client library (as well as pgsql.so for the client applications that aren't written in Java).