B-Tree los índices no ayudarán mucho para tal consulta.
Lo que necesitas como R-Tree índice y la consulta de paralelepípedo delimitador mínimo sobre él.
Desafortunadamente, MySQL no es compatible con R-Tree índices sobre 3d puntos, solo 2d . Sin embargo, puede crear un índice sobre, digamos, X y Y juntos, que serán más selectivos que cualquiera de los B-Tree índices en X y Y solo:
ALTER TABLE points ADD xy POINT;
UPDATE points
SET xy = Point(x, y);
ALTER TABLE points MODIFY xy POINT NOT NULL;
CREATE SPATIAL INDEX sx_points_xy ON points (xy);
SELECT *
FROM points
WHERE MBRContains(LineString(Point(100, 100), Point(200, 200), xy)
AND z BETWEEN 100 and 200
AND otherParameter > 10;
Esto solo es posible si su tabla es MyISAM .