[postgis-users] Computational Efficiency and Query Design Questions

Tom Kessler tom at aktalita.com
Sat Jan 8 10:11:21 PST 2011


Hello to all,

I'm developing some spatial queries and have these questions:

1)  When one makes an Explain Select request, is there any consideration
given to the computational efficiencies
of the Postgis functions themselves composing  the query?    I doubt it, but
want to make sure.  I assume selection and optimization
of the Postgis query functions is independent of the db query design.

2)  I have a polygon defined by a hundred points  an external point, and
wish to calculate an approximate point on the polygon
closest to the external  point.  Assuming the error is acceptable, is it
more computationally efficient to calculate on the bounding box than the
polygon itself?

a)     papprox  = ST_closestpoint( thegeom(polygon), p_ext)    or

b)     papprox = ST_closestpoint(box2d(thegeom(polygon), p_ext)    ??


3)  I have a table of geometries and wish to make combinatorial queries
like:

SELECT(a.thegeom, b.thegeom, c.thegeom, etc..    WHERE   a.thegeom and
b.thegeom touch
fixed points y and z  and c.thegeom intersects geometries   a and b.
Which is a better approach:

a)  build temporary tables for a and b geoms, then find c geoms that
intersect the entries in the temporary tables    or

b)  perform one select  and interate through all the combinations.   The
number of combinatorials goes exponential very quickly.  If one builds
temporary
tables, how is the spatial index best transferred from original table to the
temporary ones ? Does one have to rebuild the index from scratch.

thanks,

Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110108/a798af6d/attachment.html>


More information about the postgis-users mailing list