为包含 ST_Geometry 列的表创建空间索引

创建空间索引时,需要提供以下信息:

以下是在每种受支持的数据库中为 ST_Geometry 列创建索引的示例。

步骤:
    • Oracle
      CREATE INDEX sa_idx ON sensitive_areas(zone)
      INDEXTYPE IS sde.st_spatial_index
      PARAMETERS('st_grids=1,3,0 st_srid=1');
      
      CREATE INDEX hs_idx ON hazardous_sites(location)
      INDEXTYPE IS sde.st_spatial_index
      PARAMETERS('st_grids=1,0,0 st_srid=1');
    • DB2
      CREATE INDEX sa_idx ON sensitive_areas(zone) 
      EXTEND USING db2gse.spatial_index (1.0, 3.0, 0.0)
      
      CREATE INDEX hs_idx ON hazardous_sites(location) 
      EXTEND USING db2gse.spatial_index (1.0, 0.0, 0.0)
    • PostgreSQL
      CREATE INDEX sa_idx ON sensitive_areas 
      USING gist(zone st_geometry_ops);
      
      CREATE INDEX sa_idx ON hazardous_sites
      USING gist(location st_geometry_ops);
    • Informix
      CREATE INDEX sa_ix
      ON sensitive_areas (zone ST_Geometry_ops)
      USING RTREE;
      
      CREATE INDEX hs_ix
      ON hazardous_sites (location ST_Geometry_ops)
      USING RTREE;

相关主题


7/10/2012