[postgis-users] postgis performance
Markus Schaber
schabi at logix-tt.com
Mon Aug 8 00:45:46 PDT 2005
Hi, Fratzis,
- fratzis at olympiacos.net wrote:
> query="select gid,nomos,code_nomos,AsText(the_geom) from nomoi";
> rs = s.executeQuery( query );
Why do you use AsText(the_geom) here?
Try to use the PostGIS jdbc extension, so you can get the MultiPolygon
via rs.getObject(4), this uses the faster EWKB representation internally.
> MultiPolygon mpol = new MultiPolygon( rs.getString(4) );
This would look like:
PGgeometry wrapper = (PGgeometry) rs.getObject(4);
MultiPolygon mpol = (MultiPolygon) wrapper.getGeometry();
According to my bogus benchmarks, this provides a speedup up to factor
20 on server and client side.
> Polygon tmp = new Polygon( );
> tmp = mpol.getPolygon(0);
Why are you initializing tmp with a new, empty polygon that is just food
for the garbage collector here?
HTH,
Markus
More information about the postgis-users
mailing list