Skip site navigation (1) Skip section navigation (2)

Re: [postgis-devel] JDBC & WKB - 400% overhead

From: Markus Schaber <schabios(at)logi-track(dot)com>
To: PostGIS Development Discussion <postgis-devel(at)postgis(dot)refractions(dot)net>,"pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>,David Blasby <dblasby(at)openplans(dot)org>
Subject: Re: [postgis-devel] JDBC & WKB - 400% overhead
Date: 2005-02-23 14:57:37
Message-ID: 421C99E1.4070107@logi-track.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
[X-Post to better place for discussion]

Hi, David,

dblasby(at)openplans(dot)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(at)logi-track(dot)com | www.logi-track.com

Responses

pgsql-jdbc by date

Next:From: Sergei GeorgievDate: 2005-02-23 15:15:44
Subject: Socket timeouts (probably)
Previous:From: Ken GeisDate: 2005-02-23 08:20:14
Subject: Re: Performance tweaks

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group