[postgis-users] astext performance

Chris Faulkner chrisf at oramap.com
Mon Oct 13 12:22:08 PDT 2003


Hello

I am running postgres 7.3.4 and postgis on cygwin. I am mainly using the
simply box operator to search for polygons / lines in simple rectangular
areas. The searching seems very fast. However, the astext() function seems
very slow on large polygons.

For example, this query will comfortably execute sub-second

select gid from polygon_table where the_geomfield &&
GeometryFromText('BOX3D(532501.0 176672.88,533501.0 177321.12)'::box3d,-1);

When I do this,

select gid,astext(the_geomfield) from polygon_table where the_geomfield &&
GeometryFromText('BOX3D(532501.0 176672.88,533501.0 177321.12)'::box3d,-1);

the query takes approximately 8 seconds.  Running npoints (the_geomfield)
indicates that the field has 12500 points so it isn't small but the speed
still seems quite slow.

I suppose I have 2 questions
1. Is this usual ?
2. Is there anything I can do about it, an alternative strategy or way of
improving performance of astext ?

I am using the query in a JDBC environment.

Thanks


ChrisFaulkner








More information about the postgis-users mailing list