WEB开发网
开发学院数据库DB2 DB2 Spatial Extender 性能调优(2) 阅读

DB2 Spatial Extender 性能调优(2)

 2007-06-01 16:21:34 来源:WEB开发网   
核心提示: 清单 16. 为空间谓词指定选择性SELECT ...FROM <user_table>WHEREST_Intersects(<indexed_shape_column>, ...) = 1 SELECTIVITY 0.000001@调优空间网格索引spatial

清单 16. 为空间谓词指定选择性

SELECT ...
FROM  <user_table>
WHERE ST_Intersects(<indexed_shape_column>, ...) = 1 SELECTIVITY 0.000001@

调优空间网格索引

spatial extender 提供了一个 index advisor,以帮助您调优空间索引。index advisor 可以通过命令行工具 gseidx 访问,它的语法比较罗嗦,这一点跟 SQL 本身一样。该工具不仅可用于获得关于各种不同网格大小的建议,还可以用于收集一个已有的或计划中的(虚)索引的统计信息。所以,可以提取关于在选择某种网格大小时在哪个网格层次上将生成多少索引项的信息,而不必真正创建和物化索引。您应该注意到,Index Advisor 提供的建议可以作为索引优化的出发点。

清单 17. Spatial Extender index advisor 的示例输出

$ gseidx "CONNECT TO testdb GET GEOMETRY STATISTICS FOR COLUMN roads(shape)
    USING GRID SIZES (0.5) SHOW HISTOGRAM WITH 10 BUCKETS"
Number of Rows: 110979
Number of non-empty Geometries: 110979
Number of empty Geometries: 0
Number of null values: 0
Extent covered by data:
  Minimum X: -31.257690
  Maximum X: 66.074104
  Minimum Y: 34.824085
  Maximum Y: 72.000000
Grid Level 1
------------
Grid Size           : 0.5
Number of Geometries     : 110973
Number of Index Entries    : 147461
Number of occupied Grid Cells : 6596
Index Entry/Geometry ratio  : 1.328801
Geometry/Grid Cell ratio   : 16.824287
Maximum number of Geometries per Grid Cell: 257
Minimum number of Geometries per Grid Cell: 1
Index Entries : 1   2   3   4   10  
--------------- ------ ------ ------ ------ ------
Absolute   : 82240 24962 236  3361  174 
Percentage (%): 74.11 22.49 0.21  3.03  0.16 
Grid Level X
------------
Number of Geometries     : 6
Number of Index Entries    : 6
Histogram:
----------
  MBR Size       Geometry Count
  -------------------- --------------------
        0.340000        105777
        0.680000         4750
        1.020000         334
        1.360000          80
        1.700000          22
        2.040000          4
        2.380000          5
        2.720000          5
        3.400000          2
$ gseidx "CONNECT TO testdb GET GEOMETRY STATISTICS FOR COLUMN roads(shape)
    ADVISE GRID SIZES"
Query Window Size:   Suggested Grid Sizes:      Index Entry Cost:
--------------------  -----------------------------  ----------------------
   0.01:       0.27,   0.54,    1.6       8.3
   0.02:       0.27,   0.54,    1.6       8.7
   0.05:       0.27,   0.54,    1.6       9.9
    0.1:       0.27,   0.54,    1.6       12
    0.2:       0.17,   0.51,    1.8       17
    0.5:       0.17,   0.51,    1.8       40
     1:       0.27,   0.68,    1.7       100
     2:       0.43,    1.1,    2.2       290
     5:       0.68,    2.4,    4.8      1300
    10:       1.1,     5,     0      4500
    20:       1.7,    10,     0      15000

上一页  2 3 4 5 6 7 8 9  下一页

Tags:DB Spatial Extender

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接