建表语句如下
CREATE TABLE `nearby_user` (
`id` int NOT NULL AUTO_INCREMENT,
`name` varchar(30) NOT NULL DEFAULT '',
`location` geometry NOT NULL,
PRIMARY KEY (`id`),
SPATIAL KEY `location` (`location`)
) ENGINE=InnoDB AUTO_INCREMENT=60001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
查询语句
explain SELECT name, ST_AsText(location)
FROM nearby_user
WHERE MBRContains(ST_GeomFromText('Polygon((30000 15000,
31000 15000,
31000 16000,
30000 16000,
30000 15000))'), location);
60w 数据不走索引,possible_keys 和 key 都是 null
MySQL 版本:8.0.35-0ubuntu0.22.04.1
有了解 MySQL 空间索引的大佬可以解答一下吗?