pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markus Schaber <schabios@logi-track.com>
To: PostGIS Development Discussion <postgis-devel@postgis.refractions.net>
To: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
To: David Blasby <dblasby@openplans.org>
Subject: Re: [postgis-devel] JDBC & WKB - 400% overhead
Date: Wed, 23 Feb 2005 15:57:37 +0100
Message-ID: <421C99E1.4070107@logi-track.com> (raw)
In-Reply-To: <1109097544.421b7c482a529@webmail.limegroup.com>
References: <1109097544.421b7c482a529@webmail.limegroup.com>

[X-Post to better place for discussion]

Hi, David,

dblasby@openplans.org schrieb:
> I was checking to see if the WKB (postgis 1.0) was actually transiting
> "in binary" from the server (postgresql 8) to a JDBC (also postgresql
> 8) client.
> 
> ..
> ResultSet rs2 = st.executeQuery("select 5::float8,asBinary('POINT(0 0)')");
> rs2.next();
> byte[] bs = rs2.getBytes(2);
> assertTrue(bs.length == 21);
> 
> The WKB representation of a 'POINT(0 0)' is 21 bytes long (1 byte for
> xdr/ndr flag, 4 bytes for type, and 2 8-byte doubles = 21 bytes).
> 
> If you step through the executeQuery() command in the postgresql driver,
> you'll eventually end up in PGStream#ReceiveTupleV3().  This is where
> the actual data is received from the database.
> 
> It clearly receives 84 bytes of data from the server.  This is the bytea
> text representation:
> \001\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000
> 
> The ResultSet#getBytes() function converts this to a byte[].

Maybe your postgresql driver only uses text transfer up to now.
asBinary() returns a byte array, so this should be transferred more
efficiently.

Can you try the following query:

select 5::float8,asBinary('POINT(0 0)')::bytea

Maybe the current 8.0-310 build has fixed this. But the pgsql-jdbc list
could be the better place to ask this question, IMHO, so I forward it to
there.


Markus

-- 
markus schaber | dipl. informatiker
logi-track ag | rennweg 14-16 | ch 8001 zürich
phone +41-43-888 62 52 | fax +41-43-888 62 53
mailto:schabios@logi-track.com | www.logi-track.com

Attachments:

  signature.asc (application/pgp-signature, 255B) download

view thread (7+ messages)  latest in thread

Message-ID: <421C99E1.4070107@logi-track.com>
Permalink:  ../421C99E1.4070107@logi-track.com/
Also on:    postgresql.org/message-id/421C99E1.4070107@logi-track.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: schabios@logi-track.com, postgis-devel@postgis.refractions.net, dblasby@openplans.org
  Subject: Re: [postgis-devel] JDBC & WKB - 400% overhead
  In-Reply-To: <421C99E1.4070107@logi-track.com>
  References: <1109097544.421b7c482a529@webmail.limegroup.com> <421C99E1.4070107@logi-track.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox