11.4.9 Optimizing Spatial Analysis优化空间分析

For MyISAM and InnoDB tables, search operations in columns containing spatial data can be optimized using SPATIAL indexes. The most typical operations are:对于MyISAMInnoDB表,可以使用spatial索引优化包含空间数据的列中的搜索操作。最典型的操作是:

MySQL uses R-Trees with quadratic splitting for SPATIAL indexes on spatial columns. MySQL对空间列上的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”.MyISAMInnoDB同时支持SPATIAL和非SPATIAL索引。其他存储引擎支持非空间索引,如第13.1.15节,“CREATE INDEX语句”所述。