Opened 6 years ago

Last modified 4 months ago

#2614 new enhancement

Prepared geometry support for ST_DWithin

Reported by: robe Owned by: pramsey
Priority: high Milestone: PostGIS Fund Me
Component: postgis Version: master
Keywords: Cc:

Description (last modified by robe)

In some cases, despite what we tell people, doing an

ST_Intersects(geom1, ST_Buffer(geom2,radius)) 

is sometimes faster than ST_DWithin(geom1,geom2, radius)

Granted ST_DWithin is more accurate.

I'll come up with a small self-standing example to demonstrate the point. The one I have currently is kind of hefty.

But basic assumption is if you have a fairly large constant geometry then ST_Intersects(ST_Buffer..) often out performs ST_DWithin. I assume this is because ST_Intersects takes advantage of prepared geometries and ST_DWithin does not.

Change History (12)

comment:1 Changed 6 years ago by robe

Description: modified (diff)

comment:2 Changed 5 years ago by pramsey

This is my distance rect-tree improvement, which is still sitting half-done, taunting me... it scares me too, since distance is only 95% of what people do all the time. Mucking with it is scary.

comment:3 Changed 5 years ago by pramsey

Priority: mediumhigh

comment:4 Changed 4 years ago by pramsey

Milestone: PostGIS 2.2.0PostGIS 2.3.0

comment:5 Changed 3 years ago by robe

I take it this ain't going to happen anytime soon. Okay for me to push?

comment:6 Changed 3 years ago by robe

Milestone: PostGIS 2.3.0PostGIS 2.4.0

comment:7 Changed 2 years ago by robe

Milestone: PostGIS 2.4.0PostGIS 2.5.0

comment:8 Changed 21 months ago by pramsey

In 16393:

Edge tree index on geometries makes distance calculations on large geometries
go much faster. Needs to be used selectively and potentially with a caching
component for maximum effect. Test it out using _ST_DistanceRectTree(geom, geom)
for now.
References #2614

comment:9 Changed 21 months ago by pramsey

In 16410:

Add cache support for rect_node trees and expose for testing
in _ST_DistanceRectTreeCached(geom, geom).
References #2614

comment:10 Changed 17 months ago by robe

Milestone: PostGIS 2.5.0PostGIS next

comment:11 Changed 16 months ago by robe

Milestone: PostGIS nextPostGIS 3.0.0

Milestone renamed

comment:12 Changed 4 months ago by pramsey

Milestone: PostGIS 3.0.0PostGIS Fund Me
Note: See TracTickets for help on using tickets.