Ticket #1410 (closed defect: fixed)

Opened 17 months ago

Last modified 17 months ago

[raster] ST_Intersects doesn't seem to be using index

Reported by: robe Owned by: pracine
Priority: critical Milestone: PostGIS 2.0.0
Component: raster Version: trunk
Keywords: Cc:

Description

I just noticed this recently, but haven't ruled out its not something wrong with upgrade script.

If I do this:

SELECT  Count(o.rast) 
 FROM boston_test9 As o INNER JOIN
	o_2_boston_test9 AS o2 ON o.rast && o2.rast
 WHERE o2.rid = 1;

I see that my convex hull spatial index is being used.

However if I do:

SELECT  Count(o.rast) 
 FROM boston_test9 As o INNER JOIN
	o_2_boston_test9 AS o2 ON ST_Intersects(o.rast,o2.rast)
 WHERE o2.rid = 1;

My convex hull spatial index is no longer being used.

I thought possibly its the fact that our _ST_Intersects for raster is really really low (1), but upgrading that to 10000 didn't seem to help the situation.

Anyrate that cost needs to be set higher as its even lower than our && raster_overlaps cost function.

Change History

Changed 17 months ago by robe

ah I figured out the issue. Someone put STRICT on ST_Intersects. We need to get rid of that as it prevents the function from being broken into its parts.

Changed 17 months ago by dustymugs

I probably did that. Do you want to fix it or would you rather have me do it?

Changed 17 months ago by robe

Probably better if you did. Not near a compiler to check that I don't break something.

While you are at it, can you up the cost of _st_intersects to say like 1000 so it doesn't compete with the faster raster_overlaps check.

Changed 17 months ago by dustymugs

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

Done in r8603.

Changed 17 months ago by strk

Same in vectorland, Andrea Peri reported this exact issue. Filed #1412 for it.

Note: See TracTickets for help on using tickets.