X
首页 数据库管理 Informix 11.5 行压缩及存储优化技术应用实践2(11.5新功能)
Informix 11.5 行压缩及存储优化技术应用实践2(11.5新功能)

行数据压缩及存储优化的监控方法

我们可以使用数据库服务器实用程序、sysmaster 数据库表及 sysmaster 数据库视图来显示数据压缩统计信息及压缩字典相关的各种信息。

System-Monitoring Interface (SMI)

我们可以通过查询 sysmaster 数据库视图 syscompdicts 来显示 Informix 系统中活动及非活动数据压缩字典的元数据定义信息。

下面例子显示了 syscompdicts 中数据压缩字典信息:

> select * from sysmaster:syscompdicts;

dict_partnum        1048954
dict_code_version   1
dict_dbsnum          1
dict_create_times+  1242486139
dict_create_logun+  5
dict_create_logpos  1941580
dict_drop_timesta+  1242486268
dict_drop_loguniq+  6
dict_drop_logpos    4378760


dict_partnum        1048954
dict_code_version   1
dict_dbsnum          1
dict_create_times+  1242741114
dict_create_logun+  10
dict_create_logpos  1634380
dict_drop_timesta+  0
dict_drop_loguniq+  0
dict_drop_logpos     0

2 row(s) retrieved.

   
我们也可以通过查询 sysmaster 数据库表 syscompdicts_full 来显示 Informix 系统中活动及非活动数据压缩字典的元数据定义信息及压缩字典的二进制对象信息。

只有 informix 用户可以访问该表。

下面例子显示了 syscompdicts_full 中数据压缩字典信息:

> select * from sysmaster:syscompdicts_full;

dict_partnum        1048954
dict_code_version   1
dict_dbsnum          1
dict_create_times+  1242486139
dict_create_logun+  5
dict_create_logpos  1941580
dict_drop_timesta+  1242486268
dict_drop_loguniq+  6
dict_drop_logpos    4378760
dict_dictionary     <BYTE value>

dict_partnum        1048954
dict_code_version   1
dict_dbsnum          1
dict_create_times+  1242741114
dict_create_logun+  10
dict_create_logpos  1634380
dict_drop_timesta+  0
dict_drop_loguniq+  0
dict_drop_logpos    0
dict_dictionary     <BYTE value>


2 row(s) retrieved.


   
onstat utility

我们可以使用 onstat – g ppd 命令来显示当前正在打开的活动压缩字典信息。它不能显示非活动的压缩字典信息。

下面例子显示了 onstat – g ppd 命令输出信息:

$ onstat -g ppd

IBM Informix Dynamic Server Version 11.50.FC4 
-- On-Line -- Up 1 days 19:42:23 -- 157696 Kbytes

Partition Compression Dictionary Info
partnum    Version  DbsNum   CrTS     CrLogID  CrLogPos DrTS     DrLogID  DrLogPos
0x10017a   1        1        1242741114 10      1634380     0        0        0  

 

onstat – g ppd 命令输出描述:

partnum
使用数据压缩字典的表分区号

Version
正在创建数据压缩字典的程序代码的版本号

DbsNum
数据压缩字典所在的数据表空间号

CrTS
数据压缩字典创建的时间戳

CrLogID
当数据压缩字典创建时,所分配的日志号

CrLogPos
当数据压缩字典创建时,所分配的逻辑日志的位置

DrTS
数据压缩字典删除的时间戳

DrLogID
当数据压缩字典删除时,所分配的日志号

DrLogPos
当数据压缩字典删除时,所分配的逻辑日志的位置

我们还可以使用 onstat – g dsk 命令来跟踪当前正在执行的压缩操作的活动状态。

下面例子显示了 onstat – g dsk 命令输出信息:

$ onstat –g dsk

IBM Informix Dynamic Server Version 11.50.FC4
-- On-Line -- Up 3 days 01:18:15 -- 174080 Kbytes

Partnum      OP    Processed     Cur Page  Duration  Table
0x02900002 4  2793215   246952   158s     stock
0x02800005 4  1355213   248383   68s      order_line
 
   
onstat – g dsk 命令输出描述:

partnum
表或表分区的分区号

OP
下边标志标识执行压缩的不同操作:

1 = create_dictionary
2 = compress
4 = repack
8 = repack_offline
16 = shrink
32 = uncompress
64 = uncompress_offline
128 = estimate_compression
256 = purge_dictionary
Processed
相关操作处理的数据行数

Curr Page
当前操作正在处理的数据行的页号

Duration
操作持续的时间,以秒为单位

Table
表名称

oncheck utility

我们可以使用 oncheck -pT 命令来显示表或表分区中压缩的行数及压缩的百分比。

下面例子显示了 oncheck -pT 命令输出信息:

$ oncheck –pT stores:orders1


TBLspace Report for stores:informix.orders1

    Physical Address               1:32201
    Creation date                  04/09/2009 10:56:44
    TBLspace Flags                 8000801    Page Locking
                                              TBLspace use 4 bit bit-maps
                                              TBLspace is compressed
    Maximum row size                 80
    Number of special columns      0
    Number of keys                   0
    Number of extents                2
    Current serial value            1024
    Current SERIAL8 value           1
    Current BIGSERIAL value        1
    Current REFID value             1
    Pagesize (k)                     4
    First extent size               8
    Next extent size                8
    Number of pages allocated     81
    Number of pages used           81
    Number of data pages           80
    Number of rows                  20217
    Partition partnum              1048954
    Partition lockid               1048954

    Extents
         Logical Page     Physical Page        Size Physical Pages
                    0              1:32766         8        8
8              1:32794        73      73

Compression Dictionary Identifiers
      rowid      loguniq       logpos
       1303           10       18f04c

TBLspace Usage Report for stores:informix.orders1

    Type                  Pages      Empty  Semi-Full       Full  Very-Full
    ---------------- ---------- ---------- ---------- ---------- ----------
    Free                      0
    Bit-Map                   1
    Index                     0
    Data (Home)              80
                     ----------
    Total Pages              81

    Unused Space Summary

        Unused data slots                                 0
        Unused bytes per data page                       36
        Total unused bytes in data pages               2880

    Home Data Page Version Summary

                 Version                                 Count

                       0 (current)                         80

Compressed Data Summary

        Number of  rows                            20217
        Number of compressed rows                20217
        Percentage of compressed rows           100.00


结论

本文主要给大家介绍了 Informix 11.5 数据库行压缩技术的原理、优势,行压缩技术的具体使用及相应的监控方法。通过使用行压缩技术,不仅可以节省数据存储空间,还可以提高数据库处理性能,加快数据库备份及恢复的操作时间。有关行压缩技术更详细的信息,大家可以参考 Informix 信息中心的相关内容。