[geos-devel] Possible speed improvement for overlay operations

Martin Davis mtnclimb at gmail.com
Wed Dec 5 11:08:08 PST 2018

(now it's me needing to remind you to cross-post to the list  :)

On Wed, Dec 5, 2018 at 10:59 AM Paul van der Linden <
paul.doskabouter at gmail.com> wrote:

> > Hmmm - is this because st_difference includes an envelope check?  In
> PostGIS or GEOS?
> It's because most (just not the ones fully within the hole) of the forests
> do intersect with "world-hole" and thus trigger the expensive operation of
> noding, testing self-intersect and whatnot, while the st_difference only
> triggers that for polygons intersecting with that hole.

So if I understand this, the difference is actually between the "positive"
of the holes in the "world-hole polygon" and forest polys which intersect
it?  If so that makes sense.

> And as for getting lines and polygons out of an intersection isn't that
> bad, just add a st_collectionextract and all will be fine.

Right... maybe that's good enough.  Although there might be a bit of
performance improvement possible if the overlay ops know what is wanted
ahead of time.

> > select ST_IntersectionPrepared(geomA, geomB) R
> > from A join B on A.geom && B.geom
> > where R != empty/null
> That would indeed be perfect! At least if that doesn't involve calculating
> st_intersection twice...

Good to know that makes sense.  I'm not sure how the preparation caching
will work, but am hoping to understand that better soon.  And to have time
to work on this improvement - which should be a win for a lot of users.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geos-devel/attachments/20181205/a026e154/attachment.html>

More information about the geos-devel mailing list