Ticket #558 (closed defect: invalid)

Opened 3 years ago

Last modified 3 years ago

ST_Intersects with Large Number of Points

Reported by: jabts Owned by: pramsey
Priority: medium Milestone: PostGIS 1.5.2
Component: postgis Version: 1.5.X
Keywords: intersects slow Cc:

Description

When using a simple square polygon as one of the arguments, and a linestring or multilinestring with > 15000 points as the other argument, if the query is to return true, it takes a very long time and/or doesn't return properly. Whereas if the query should return false, it returns "immediately".

This problem seems two fold, a) why it would return false quickly and not true (seems to me it should be reverse of that) and b) there is a definite scaling problem as the number of points go up.

Attached is a file with some sample linestrings and issues that led to this.

Attachments

postgisBug.txt Download (1.4 MB) - added by jabts 3 years ago.

Change History

Changed 3 years ago by jabts

Changed 3 years ago by pramsey

  • status changed from new to closed
  • resolution set to invalid

The function can return false immediately if the bounding boxes to not intersect. Unless you have a suggestion on how to improve performance, this doesn't seem like a bug to me, it seems expected: more points to test take longer to test. If you have large linestrings (geographically) and small boxes, a simple way to improve performance is to "denormalize" your lines: chop them into about 400-vertex segments per object and duplicate the attributes or provide a look-up table between them. That way the index can have more effect in choosing the "right" line segments to test with a particular box.

Note: See TracTickets for help on using tickets.