为什么MySQL不使用空间索引?

时间:2019-03-08 01:07:28

标签: mysql sql mysql-workbench

我在mysql中有问题。我为一些多边形创建了一个表并添加了索引,但选择数据时未使用索引 这是我用于存储多边形的表

CREATE TABLE road_polygon (
id bigint(12) unsigned NOT NULL AUTO_INCREMENT,
  road_polygon polygon NOT NULL,
  PRIMARY KEY (id),
  SPATIAL INDEX (road_polygon)
) ENGINE=InnoDB

当我查询数据时不使用索引。我检查了Mysql文档和许多帖子,但没有解决,我也尝试更改MyIsam不起作用

explain  
    select id, road_polygon 
    from road_polygon 
    where st_contains(road_polygon, POINT(32.027856, 36.803250));

id  select_type table   partitions  type    possible_keys   key key_len ref rows    filtered    Extra
1   SIMPLE  road_polygon    NULL    ALL NULL    NULL    NULL    NULL    77  100.00  Using where

我也使用Mysql 8.0.12 InnoDb。

请任何帮助如何解决此问题。 谢谢。

0 个答案:

没有答案
相关问题