8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

13.4.9 优化空间分析13.4.9 Optimizing Spatial Analysis

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

  • 点查询,用于搜索包含给定点的所有对象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 对空间列的 SPATIAL 索引使用 具有二次分割的 R 树。SPATIAL 索引是使用几何图形的最小外接矩形 (MBR) 构建的。对于大多数几何图形,MBR 是包围几何图形的最小矩形。对于水平或垂直的线串,MBR 是退化为线串的矩形。对于一个点,MBR 是退化为点的矩形。MySQL uses R-Trees with quadratic splitting for SPATIAL indexes on spatial columns. A SPATIAL index is built using the minimum bounding rectangle (MBR) of a geometry. 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. For a point, the MBR is a rectangle degenerated into the point.

也可以在空间列上创建普通索引。在非 SPATIAL 索引中,除 POINT 列外,必须为任何空间列声明前缀。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.

MyISAM 和 InnoDB 都支持 SPATIAL 和非 SPATIAL 索引。其他存储引擎支持非 SPATIAL 索引,如 第 15.1.15 节,“CREATE INDEX 语句” 所述。MyISAM and InnoDB support both SPATIAL and non-SPATIAL indexes. Other storage engines support non-SPATIAL indexes, as described in Section 15.1.15, “CREATE INDEX Statement”.