Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#1410 closed defect (fixed)

[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: master
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 (5)

comment:1 by robe, 13 years ago

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.

comment:2 by dustymugs, 13 years ago

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

comment:3 by robe, 13 years ago

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.

comment:4 by dustymugs, 13 years ago

Resolution: fixed
Status: newclosed

Done in r8603.

comment:5 by strk, 13 years ago

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

Note: See TracTickets for help on using tickets.