For 对于MyISAM
and InnoDB
tables, search operations in columns containing spatial data can be optimized using SPATIAL
indexes. The most typical operations are:MyISAM
和InnoDB
表,可以使用spatial索引优化包含空间数据的列中的搜索操作。最典型的操作是:
Point queries that search for all objects that contain a given point搜索包含给定点的所有对象的点查询
Region queries that search for all objects that overlap a given region搜索与给定区域重叠的所有对象的区域查询
MySQL uses R-Trees with quadratic splitting for MySQL对空间列上的SPATIAL
indexes on spatial columns. SPATIAL
索引使用“具有二次分割的R-Trees”。A SPATIAL
index is built using the minimum bounding rectangle (MBR) of a geometry. SPATIAL
索引是使用几何体的最小边界矩形(MBR)构建的。For most geometries, the MBR is a minimum rectangle that surrounds the geometries. For a horizontal or a vertical linestring, the MBR is a rectangle degenerated into the linestring. 对于大多数几何体,MBR是围绕几何体的最小矩形。对于水平或垂直线串,MBR是退化为线串的矩形。For a point, the MBR is a rectangle degenerated into the point.对于一个点,MBR是退化为该点的矩形。
It is also possible to create normal indexes on spatial columns. 也可以在空间列上创建普通索引。In a non-在非SPATIAL
index, you must declare a prefix for any spatial column except for POINT
columns.SPATIAL
索引中,必须为除POINT
列之外的任何空间列声明前缀。
MyISAM
and InnoDB
support both SPATIAL
and non-SPATIAL
indexes. Other storage engines support non-SPATIAL
indexes, as described in Section 13.1.15, “CREATE INDEX Statement”.MyISAM
和InnoDB
同时支持SPATIAL
和非SPATIAL
索引。其他存储引擎支持非空间索引,如第13.1.15节,“CREATE INDEX语句”所述。