在DB2数据库中统计网格索引的方法

今天看了一篇ESRI的官方文章,内容如下:

Technical Article   Error:  Cannot get Map Layer Spatial Index Statistics for
 the layer
Article ID:     18000
Software:      ArcGIS - ArcInfo 8.1, 8.1.2, 8.2, 8.3, 9.0, 9.1, 9.2, 9.3 ArcSDE 8.1, 8.1.2, 8.2, 8.3, 9.0, 9.1, 9.2, 9.3
Platforms:      Windows NT 4.0, 2000 AIX 4.3.3.0
Error Message
Running sdelayer -o si_stats on a DB2 layer returns the following error:

"Error: DBMS does NOT support this function (-1008).
Error: Cannot get Map Layer Spatial Index Statistics for the layer."


Cause
sdelayer -o si_stats is
 not supported with data stored in
 DB2.

Solution or Workaround
There is
 no solution. ArcSDE does not support this
 operation as
 the RDBMS (DB2) does not do
 so.

大体意思是使用sdelayer –o si_stats命令无法统计DB2数据库中的网格索引。

使用该命令可以统计oracle数据库中的网格索引,可以参考我的另一篇博客:

http://blog.csdn.net/liufeng1980423/archive/2011/03/24/6273915.aspx

 

我自己用了一下这个命令,的确是不行。后来查了一下DB2的文档,原来DB2数据的Spatial Extender组件提供了一个命令gseidx来统计网格索引,实际上该命令也应该是ESRI和IBM联合开发的。

以下是该命令的用法:

 

[db2inst1@lstest ~]$ gseidx

 

 

Usage: gseidx <connect options> <command>

 

<connect options>

    CONNECT TO database-name [ USER user-id USING password ]

 

<command>

    GET GEOMETRY STATISTICS

        { FOR COLUMN table-schema . table-name ( column-name )

            [ USING GRID SIZES ( grid-size-1, grid-size-2, grid-size-3 ) ] |

          FOR INDEX index-schema . index-name [ DETAIL ] }

        [ ANALYZE number { ROWS | PERCENT } [ ONLY ] ]

        [ SHOW [ MINIMUM BOUNDING RECTANGLE ] HISTOGRAM [ WITH n BUCKETS ] ]

        [ ADVISE [ GRID SIZES ] ]

 

主要是两方面的功能:

1. 还没建立索引的情况下,得到各种网格大小的统计值:

[db2inst1@lstest ~]$ gseidx "connect to mydb user sde using esrichina get geometry statistics for column sde.streets(shape) using grid sizes (0.011)" Number of Rows: 2721089 Number of non-empty Geometries: 2721089 Number of empty Geometries: 0 Number of null values: 0 Extent covered by data: Minimum X: -167.540447 Maximum X: -84.901820 Minimum Y: 30.225470 Maximum Y: 71.343960 Grid Level 1 ------------ Grid Size : 0.011 Number of Geometries : 2721088 Number of Index Entries : 3627039 Number of occupied Grid Cells : 432802 Index Entry/Geometry ratio : 1.332937 Geometry/Grid Cell ratio : 6.287143 Maximum number of Geometries per Grid Cell: 521 Minimum number of Geometries per Grid Cell: 1 Index Entries : 1 2 3 4 10 --------------- ------ ------ ------ ------ ------ Absolute : 2051228 554025 14491 92666 8678 Percentage (%): 75.38 20.36 0.53 3.41 0.32 Grid Level 2 ------------ Grid Size : 0 No geometries indexed on this level. Grid Level 3 ------------ Grid Size : 0 No geometries indexed on this level. Grid Level X ------------ Number of Geometries : 1 Number of Index Entries : 1 GSE0000I The operation was completed successfully.

 

2。 获取现有索引的统计值
 [db2inst1@lstest ~]$ gseidx "connect to mydb user sde using esrichina get geometry statistics for index sde.a6_ix1 details show histogram advise"


Number of Rows: 2721089
Number of non-empty Geometries: 2721089
Number of empty Geometries: 0
Number of null values: 0

Extent covered by data:
    Minimum X: -167.540447
    Maximum X: -84.901820
    Minimum Y: 30.225470
    Maximum Y: 71.343960



Grid Level 1
------------

Grid Size                     : 0.011
Number of Geometries          : 2721088
Number of Index Entries       : 3627039

Number of occupied Grid Cells : 432802
Index Entry/Geometry ratio    : 1.332937
Geometry/Grid Cell ratio      : 6.287143
Maximum number of Geometries per Grid Cell: 521
Minimum number of Geometries per Grid Cell: 1

Index Entries :  1      2      3      4      10
---------------  ------ ------ ------ ------ ------
Absolute      :  2051228 554025 14491  92666  8678
Percentage (%):  75.38  20.36  0.53   3.41   0.32



Grid Level 2
------------

Grid Size                     : 0
No geometries indexed on this level.


Grid Level 3
------------

Grid Size                     : 0
No geometries indexed on this level.


Grid Level X
------------

Number of Geometries          : 1
Number of Index Entries       : 1



Histogram:
----------
    MBR Size             Geometry Count
    -------------------- --------------------
                0.000010                  112
                0.000015                   21
                0.000020                 1186
                0.000025                  617
                0.000030                 2206
                0.000035                 1537
                0.000040                 2346
                0.000045                 3854
                0.000050                 2567
                0.000055                 6034
                0.000060                 1618
                0.000065                 8129
                0.000070                 3369
                0.000075                 8007
                0.000080                10254
                0.000085                 1364
                0.000090                 9200
                0.000095                 3424
                0.000100                 8022
                0.000150                66341
                0.000200                54432
                0.000250                64271
                0.000300                64382
                0.000350                53820
                0.000400                66869
                0.000450                67226
                0.000500                56410
                0.000550                62615
                0.000600                65197
                0.000650                61644
                0.000700                53687
                0.000750                65454
                0.000800                61497
                0.000850                49001
                0.000900                60382
                0.000950                59034
                0.001000                46622
                0.001500               384115
                0.002000               238499
                0.002500               165449
                0.003000               114574
                0.003500                90225
                0.004000                78282
                0.004500                64538
                0.005000                48278
                0.005500                40237
                0.006000                35074
                0.006500                31296
                0.007000                29106
                0.007500                31278
                0.008000                24204
                0.008500                22628
                0.009000                23168
                0.009500                18717
                0.010000                15825
                0.015000                90616
                0.020000                15585
                0.025000                 3832
                0.030000                 2201
                0.035000                  611


Query Window Size:     Suggested Grid Sizes:           Index Entry Cost:
--------------------   -----------------------------   ----------------------
      0.01:           0.0039,    0.0078,     0.016            0.46
      0.02:           0.0062,     0.016,         0             1.1
      0.05:           0.0098,     0.029,         0             4.7
       0.1:            0.016,     0.048,         0              15
       0.2:            0.025,     0.075,         0              50
       0.5:            0.039,         0,         0             260
         1:            0.062,         0,         0             980
         2:            0.062,         0,         0            3700
         5:             0.16,         0,         0           21000
        10:             0.16,         0,         0           85000
        20:             0.16,         0,         0         3.3e+05

GSE0000I  The operation was completed successfully.

具体更详细信息可以查看

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp

你可能感兴趣的:(数据库,db2,user,layer,statistics,网格)