I don't have a mySQL test, but I wonder how effective its INTERSECT is:
select points.* from points join ( select id from points where x > 100 AND x < 200 intersect select id from points where y > 100 AND y < 200 intersect select id from points where z > 100 AND z < 200 ) as keyset on points.id = keyset.id
It is not necessary to recommend it, but it is something to try, especially if you have separate indices on x, y and z.
EDIT: Since mySQl does not support INTERSECT, the above query can be rewritten using JOINS inline views. Each view will contain a set of keys, and each view will have the advantage of separate indexes that you placed on x, y, and z. Performance will depend on the number of keys returned and the intersect / join algorithm.
First, I tested the intersection approach (in SQLite) to find out if there are ways to improve performance in spatial queries without using their R-Tree module. INTERSECT was actually slower than using one non-composite index on one of the spatial values, and then scanning a subset of the base table to get other spatial values. But the results may vary depending on the size of the database. After the table has reached gigantic size, and the I / O disk becomes more important as a performance factor, it may be more efficient to cross discrete sets of keys, each of which was created from the index, than to check the underlying subequent table against the original sample from the index .
Tim
source share