I'm completely stumped trying to create any index MySQL will use at all
for my SELECT.
 
I've got a table with four columns describing the upper-right and
lower-left coordinates of a rectangle - RIGHT, LEFT (max X, min X), TOP,
BOTTOM (max Y, min Y).  I have an X, Y coordinate and I want to select
all rows for which the X, Y point is "inside" the rectangle.  In other
words:
 
SELECT * FROM ROWS WHERE X <= RIGHT AND X >= LEFT AND Y >= BOTTOM AND Y
<= TOP
 
(using BETWEEN didn't make any difference).
 
I have tried indexes on RIGHT, LEFT, TOP, BOTTOM, RIGHT+LEFT,
TOP+BOTTOM, and RIGHT+LEFT+TOP+BOTTOM and none of them get used.  All
fields are FLOAT.  I can't figure out how to get any index to be used,
nor how to restructure my query to improve things.  Thanks!
 
            - Ed
 
Ed McNierney
President and Chief Mapmaker
TopoZone.com
[EMAIL PROTECTED]
 

Reply via email to