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 48712528BF for ; Fri, 17 Jun 2005 18:29:11 -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 28198-04 for ; Fri, 17 Jun 2005 21:28:53 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id 600455289D for ; Fri, 17 Jun 2005 18:28:51 -0300 (ADT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.20]) by yass.opencloud.co.nz with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1DjOOS-0006kV-BS; Sat, 18 Jun 2005 09:28:52 +1200 Message-ID: <42B34093.6000206@opencloud.com> Date: Sat, 18 Jun 2005 09:28:51 +1200 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050324) 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> X-Enigmail-Version: 0.90.2.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/98 X-Sequence-Number: 13060 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??? I'm slightly confused about what you're trying to do here. Are you talking about compressing the protocol stream between the server and client? This would be a win if the bottleneck is the speed of the network between server and client. If so, the protocol doesn't directly support it but there was some discussion on -hackers about a pluggable stream filter API that could be used for compression: http://archives.postgresql.org/pgsql-hackers/2005-04/msg00792.php. Alternatively, since the connection to the DB server is just a TCP connection, you could write a small server that accepts connections locally, compresses data, and forwards it over a separate TCP connection to an equivalent server that decompresses the data and sends it on to the server. A quick&dirty way of doing that is using ssh's port-tunnelling options over a compressed ssh connection, something like this: clienthost$ ssh -N -C -L 5432:serverhost:5432 user@serverhost (then point the JDBC driver at 'clienthost') If your concern is about the volume of data that the JDBC layer is processing, then compression at the protocol level isn't going to help. You'll need to do the transformation to a more compact form on the server side (e.g. via an appropriate PL or C function) and be ready to receive that form in your application. -O