46 DBMS_COMPRESSION

DBMS_COMPRESSIONパッケージは、アプリケーションの正しい圧縮レベルを簡単に選択できるインタフェースを提供します。

この章のトピックは、次のとおりです:

46.1 DBMS_COMPRESSIONの概要

DBMS_COMPRESSIONパッケージは、データベース環境内で圧縮に関連する情報を収集します。これには、パーティション化された表およびパーティション化されていない表について圧縮率を推測し、以前に圧縮された表に関する行レベルの圧縮情報を収集するツールが含まれます。これによって、圧縮に関連した決定を行うための適切な情報が得られます。

46.2 DBMS_COMPRESSIONのセキュリティ・モデル

DBMS_COMPRESSSIONパッケージはAUTHID CURRENT USERで定義されるため、現在のユーザーの権限で実行されます。

46.3 DBMS_COMPRESSIONの定数

DBMS_COMPRESSIONパッケージでは、パラメータ値の指定に使用できる定数が使用されます。

これらの定数を、次の表に示します。

表46-1 DBMS_COMPRESSIONの定数 - 圧縮タイプ

定数 タイプ 説明

COMP_NOCOMPRESS

NUMBER

1

圧縮なし

COMP_ADVANCED

NUMBER

2

高度な行圧縮

COMP_QUERY_HIGH

NUMBER

4

問合せ用の高ウェアハウス圧縮(ハイブリッド列圧縮)

COMP_QUERY_LOW

NUMBER

8

問合せ用の低ウェアハウス圧縮(ハイブリッド列圧縮)

COMP_ARCHIVE_HIGH

NUMBER

16

高アーカイブ圧縮(ハイブリッド列圧縮)

COMP_ARCHIVE_LOW

NUMBER

32

低アーカイブ圧縮(ハイブリッド列圧縮)

COMP_BLOCK

NUMBER

64

圧縮ブロック

COMP_LOB_HIGH

NUMBER

128

LOB操作のための高圧縮レベル

COMP_LOB_MEDIUM

NUMBER

256

LOB操作のための中圧縮レベル

COMP_LOB_LOW

NUMBER

512

LOB操作のための低圧縮レベル

COMP_INDEX_ADVANCED_HIGH

NUMBER

1024

索引のための高圧縮レベル

COMP_INDEX_ADVANCED_LOW

NUMBER

2048

索引のための低圧縮レベル

COMP_RATIO_LOB_MINROWS

NUMBER

1000

LOB圧縮率が見積られるオブジェクトの必要最低限のLOB数

COMP_BASIC

NUMBER

4096

基本表圧縮

COMP_RATIO_LOB_MAXROWS

NUMBER

5000

LOB圧縮率の計算に使用されるLOBの最大数

COMP_INMEMORY_NOCOMPRESS

NUMBER

8192

インメモリー圧縮なし

COMP_INMEMORY_DML

NUMBER

16384

DMLのためのインメモリー圧縮レベル

COMP_INMEMORY_QUERY_LOW

NUMBER

32768

問合せパフォーマンスのために最適化されたインメモリー圧縮レベル

COMP_INMEMORY_QUERY_HIGH

NUMBER

65536

問合せパフォーマンスおよび領域の節約に対して最適化されたインメモリー圧縮レベル

COMP_INMEMORY_CAPACITY_LOW

NUMBER

131072

容量を最適化するインメモリー低圧縮レベル

COMP_INMEMORY_CAPACITY_HIGH

NUMBER

262144

容量を最適化するインメモリー高圧縮レベル

COMP_RATIO_MINROWS

NUMBER

1000000

HCC比が見積もられるオブジェクトの必要最低限の行数

COMP_RATIO_ALLROWS

NUMBER

-1

オブジェクトのすべての行を使用してHCC比が見積もられたことを示します。

OBJTYPE_TABLE

PLS_INTEGER

1

圧縮率を見積もるオブジェクトをタイプ表として識別します。

OBJTYPE_INDEX

PLS_INTEGER

2

圧縮率が見積もられるオブジェクトをタイプ索引として識別します。

ノート:

ハイブリッド列圧縮は特定のOracleストレージ・システムの機能です。詳細は、『Oracle Database概要』を参照してください。

46.4 DBMS_COMPRESSIONのデータ構造

DBMS_COMPRESSIONパッケージでは、レコード・タイプとタイプを定義します。

レコード・タイプ

COMPRECレコード・タイプ

46.4.1 COMPRECレコード・タイプ

COMPRECレコード・タイプは、表の個々の索引圧縮率を計算するためのレコードです。

構文

TYPE COMPREC IS RECORD(
  ownname           varchar2(255),
  objname           varchar2(255),
  blkcnt_cmp        PLS_INTEGER,
  blkcnt_uncmp      PLS_INTEGER,
  row_cmp           PLS_INTEGER,
  row_uncmp         PLS_INTEGER,
  cmp_ratio         NUMBER,
  objtype           PLS_INTEGER);

フィールド

表46-2 COMPRECの属性

フィールド 説明

ownname

オブジェクト所有者のスキーマ。

objname

オブジェクト名

blkcnt_cmp

オブジェクトの圧縮されたサンプルに使用されるブロック数。

blkcnt_uncmp

オブジェクトの圧縮解除されたサンプルに使用されるブロック数。

row_cmp

オブジェクトの圧縮されたサンプルにあるブロック内の行数。

row_uncmp

オブジェクトの圧縮解除されたサンプルにあるブロック内の行数。

cmp_ratio

圧縮比、blkcnt_uncmpblkcnt_cmpで割った値。

objtype

オブジェクトのタイプ

46.4.2 COMPRECLIST表タイプ

COMPRECLISTは、COMPRECレコード・タイプの表タイプです。

構文

TYPE compreclist IS TABLE OF comprec;

46.5 DBMS_COMPRESSIONサブプログラムの要約

DBMS_COMPRESSIONパッケージでは、GET_COMPRESSION_RATIOプロシージャおよびGET_COMPRESSION_TYPEファンクションのサブプログラムが使用されます。

表46-3 DBMS_COMPRESSIONパッケージのサブプログラム

サブプログラム 説明

GET_COMPRESSION_RATIOプロシージャ

表の圧縮比を分析し、表の圧縮率に関する情報を提供します。

GET_COMPRESSION_TYPEファンクション

特定の行に対する圧縮タイプを戻します。

46.5.1 GET_COMPRESSION_RATIOプロシージャ

このプロシージャを使用して、表または索引の圧縮比を分析し、オブジェクトの圧縮率に関する情報を得ます。各種のパラメータを指定して、個別の圧縮タイプを選択的に分析できます。

Oracle Database 23cでは、このプロシージャが拡張されていて、少ない領域の使用でLOBの圧縮率をより速く推定するようになりました。BasicFile LOBの圧縮率の推定も可能になりました。これにより、BasicFile LOBのSecureFile LOBへの移行前に、BasicFile LOBを圧縮するかどうかを事前に決定できます。さらに、LOBバイト・レベルでの圧縮比の推定や、表内のLOBデータの圧縮にかかる時間の推定もできます(時間単位)。

構文

圧縮率を取得するための構文は、オブジェクト、LOB、IOTおよび表の索引に応じて異なります。

  • オブジェクト(表または索引。デフォルトは表)の圧縮率を取得する構文。

    DBMS_COMPRESSION.GET_COMPRESSION_RATIO (
       scratchtbsname        IN     VARCHAR2, 
       ownname               IN     VARCHAR2, 
       objname               IN     VARCHAR2,
       subobjname            IN     VARCHAR2,
       comptype              IN     NUMBER,
       blkcnt_cmp            OUT    PLS_INTEGER,
       blkcnt_uncmp          OUT    PLS_INTEGER,
       row_cmp               OUT    PLS_INTEGER,
       row_uncmp             OUT    PLS_INTEGER,
       cmp_ratio             OUT    NUMBER,
       comptype_str          OUT    VARCHAR2,
       subset_numrows        IN     NUMBER  DEFAULT COMP_RATIO_MINROWS,
       objtype               IN     PLS_INTEGER DEFAULT OBJTYPE_TABLE); 
    
  • BasicFile LOBとSecureFile LOBの圧縮率を取得する構文:

    DBMS_COMPRESSION.GET_COMPRESSION_RATIO (
       scratchtbsname        IN     VARCHAR2,
       tabowner              IN     VARCHAR2,
       tabname               IN     VARCHAR2,
       lobname               IN     VARCHAR2,
       partname              IN     VARCHAR2,
       comptype              IN     NUMBER,
       blkcnt_cmp            OUT    PLS_INTEGER,
       blkcnt_uncmp          OUT    PLS_INTEGER,
       lobcnt                OUT    PLS_INTEGER,
       cmp_ratio             OUT    NUMBER,
       comptype_str          OUT    VARCHAR2,
       byte_comp_ratio       OUT    NUMBER,
       total_time            OUT    NUMBER
       subset_numrows        IN     NUMBER DEFAULT COMP_RATIO_LOB_MAXROWS);
    
  • 表のすべての索引の圧縮率を取得する構文。圧縮率はコレクションとして戻されます。

    DBMS_COMPRESSION.GET_COMPRESSION_RATIO (
      scratchtbsname        IN     VARCHAR2,
      ownname               IN     VARCHAR2,
      tabname               IN     VARCHAR2,
      comptype              IN     NUMBER,
      index_cr              OUT    DBMS_COMPRESSION.COMPRECLIST,
      comptype_str          OUT    VARCHAR2,
      subset_numrows        IN     NUMBER DEFAULT COMP_RATIO_INDEX_MINROWS);
  • IOTの圧縮率を取得する構文。

    DBMS_COMPRESSION.GET_COMPRESSION_RATIO (
         scratchtbsname       IN     VARCHAR2,
         ownname              IN     VARCHAR2,
         objname              IN     VARCHAR2,
         subobjname           IN     VARCHAR2,
         comptype             IN     NUMBER,
         iotcomp_cr           OUT    DBMS_COMPRESSION.COMPRECLIST,
         comptype_str         OUT    VARCHAR2,
         subset_numrows       IN     NUMBER DEFAULT COMP_RATIO_INDEX_MINROWS);  

パラメータ

表46-4 GET_COMPRESSION_RATIOプロシージャのパラメータ

パラメータ 説明

scratchtbsname

分析に使用できる一時スクラッチ表領域。

ownname / tabowner

分析する表のスキーマ。

tabname

分析する表の名前。

objname

オブジェクト名

subobjname

オブジェクトのパーティションまたはサブパーティションの名前。

comptype

分析を実行する対象の圧縮タイプ。

オブジェクトが索引の場合、有効な圧縮タイプは、COMP_INDEX_ADVANCED_HIGH (値1024)およびCOMP_INDEX_ADVANCED_LOW (値2048)のみです。

ノート: COMP_BLOCK (値64)およびCOMP_BASIC (値4096)の圧縮タイプは、いずれのオブジェクト・タイプでもこのパラメータに指定できません。

blkcnt_cmp

表の圧縮されたサンプルに使用されるブロック数。

blkcnt_uncmp

表の圧縮解除されたサンプルに使用されるブロック数。

row_cmp

表の圧縮されたサンプルにあるブロック内の行数。

row_uncmp

表の圧縮解除されたサンプルにあるブロック内の行数。

cmp_ratio

圧縮比、blkcnt_uncmpblkcnt_cmpで割った値。

comptype_str

圧縮タイプを説明する文字列。

subset_numrows

圧縮比を見積もるためにサンプリングされた行数。

objtype

OBJTYPE_TABLEまたはOBJTYPE_INDEXのいずれかのオブジェクト・タイプ。

lobname

LOB列名

partname

パーティション化された表の場合は、関連したパーティション名。

lobcnt

圧縮比を見積もるために実際にサンプリングされたLOBの数。

index_cr

索引のリストおよび見積り済の圧縮率。

iotcomp_cr

IOTの圧縮率

最初のオブジェクトには、IOT全体の圧縮率が含まれます。

2番目のオブジェクトには、IOTの最上位索引セクション(オーバーフロー・セグメントを除く)の圧縮率のみが含まれます。

byte_comp_ratio LOBバイト・レベルでの圧縮率を提示します。
total_time 表内のLOBデータを圧縮するためにかかる推定時間を提示します(時間単位)。

次の例は、高度な行圧縮の圧縮率を推定する方法を示しています。

SET SERVEROUTPUT ON
DECLARE
  1_blkcnt_cmp   PLS_INTEGER;
  1_blkcnt_uncmp PLS_INTEGER;
  1_row_cmp      PLS_INTEGER;
  1_row_uncmp    PLS_INTEGER;
  1_cmp_ratio    NUMBER;
  1_comptype_str VARCHAR2(32767);
BEGIN
   DBMS_COMPRESSION.GET_COMPRESSION_RATIO (
   scratchtbsname => 'USERS' ,
   ownname	  => 'TEST' ,
   objname	  => 'SALES' ,
   subobjname     =>  NULL ,
   comptype       =>  DBMS_COMPRESSION.COMP_ADVANCED,
   blkcnt_cmp     => 1_blkcnt_cmp,
   blkcnt_uncmp   => 1_blkcnt_uncmp,
   row_cmp	  => 1_row_cmp,
   row_uncmp      => 1_row_uncmp,
   cmp_ratio      => 1_cmp_ratio,
   comptype_str   => 1_comptype_str,
   subset_numrows => DBMS_COMPRESSION.comp_ratio_minrows,
   objtype	  => DBMS_COMPRESSION.objtype_table
  );
DBMS_OUTPUT.put_line( 'Number of blocks used by the compressed sample of the object	:  ' || 1_blkcnt_cmp);
DBMS_OUTPUT.put_line( 'Number of blocks used by the uncompressed sample of the object	:  ' || 1_blkcnt_uncmp);
DBMS_OUTPUT.put_line( 'Number of rows in a block in compressed sample of the object	:  ' || 1_row_cmp);
DBMS_OUTPUT.put_line( 'Number of rows in a block in uncompressed sample of the object	:  ' || 1_row_uncmp);
DBMS_OUTPUT.put_line( 'Estimated Compression Ratio of Sample                       	:  ' || 1_cmp_ratio);
DBMS_OUTPUT.put_line( 'Compression Type							:  ' || 1_comptype_str);
END;
/

高度な行圧縮(表全体)の圧縮アドバイザ見積りの出力:

Number of blocks used by the compressed sample of the object     : 165
Number of blocks used by the uncompressed sample of the object   : 629
Number of rows in a block in compressed sample of the object     : 599
Number of rows in a block in uncompressed sample of the object   : 157
Estimated Compression Ratio of Sample			         : 3.8
Compression Type						 : “Compress Advanced”

次の例は、拡張索引圧縮(低)の圧縮率を見積もる方法を示しています。

SET SERVEROUTPUT ON
DECLARE
  1_blkcnt_cmp	   PLS_INTEGER;
  1_blkcnt_uncmp   PLS_INTEGER
  1_row_cmp	   PLS_INTEGER;
  1_row_uncmp	   PLS_INTEGER;
  1_cmp_ratio	   NUMBER;
  1_comptype_str   VARCHAR2(32767);
BEGIN
   DBMS_COMPRESSION.GET_COMPRESSION_RATIO (
    scratchtbsname =>       'USERS' ,
    ownname	   =>       'TEST' ,
    objname	   =>       'SALES_IDX' ,
    subobjname     =>        NULL ,
    comptype       =>        DBMS_COMPRESSION.COMP_INDEX_ADVANCED_LOW,
    blkcnt_cmp     =>        1_blkcnt_cmp,
    blkcnt_uncmp   =>        1_blkcnt_uncmp,
    row_cmp	   =>        1_row_cmp,
    row_uncmp      =>        1_row_uncmp,
    cmp_ratio      =>        1_cmp_ratio,
    comptype_str   =>        1_comptype_str,
    subset_numrows =>        DBMS_COMPRESSION.comp_ratio_minrows,
    objtype	   =>        DBMS_COMPRESSION.objtype_index
   );
DBMS_OUTPUT.put_line( 'Number of blocks used by the compressed sample of the object   :  ' || 1_blkcnt_cmp);
DBMS_OUTPUT.put_line( 'Number of blocks used by the uncompressed sample of the object :  ' || 1_blkcnt_uncmp);
DBMS_OUTPUT.put_line( 'Number of rows in a block in compressed sample of the object   :  ' || 1_row_cmp);
DBMS_OUTPUT.put_line( 'Number of rows in a block in uncompressed sample of the object :  ' || 1_row_uncmp);
DBMS_OUTPUT.put_line( 'Estimated Compression Ratio of Sample                          :  ' || 1_cmp_ratio);
DBMS_OUTPUT.put_line( 'Compression Type						      :  ' || 1_comptype_str);
END;
/

拡張索引圧縮(低)の圧縮アドバイザ見積りの出力:

Number of blocks used by the compressed sample of the object     : 243
Number of blocks used by the uncompressed sample of the object   : 539
Number of rows in a block in compressed sample of the object     : 499
Number of rows in a block in uncompressed sample of the object   : 145
Estimated Compression Ratio of Sample				 : 2.2
Compression Type						 : “Compress Advanced Low”

次の例は、拡張LOB圧縮(中)の圧縮率を見積もる方法を示しています。

SET SERVEROUTPUT ON
DECLARE
  1_blkcnt_cmp     PLS_INTEGER;
  1_blkcnt_uncmp   PLS_INTEGER;
  1_row_cmp	   PLS_INTEGER;
  1_lobcnt	   PLS_INTEGER;
  1_cmp_ratio      NUMBER;
  1_comptype_str   VARCHAR2(32767);
BEGIN
   DBMS_COMPRESSION.GET_COMPRESSION_RATIO (
    scratchtbsname => 'USERS' ,
    tabowner       => 'TEST' ,
    tabname	   => 'PARTS' ,
    lobname	   =>  'PART_DESCRIPTION' ,
    partname       =>  NULL ,
    comptype       =>  DBMS_COMPRESSION.COMP_LOB_MEDIUM,
    blkcnt_cmp     => 1_blkcnt_cmp,
    blkcnt_uncmp   => 1_blkcnt_uncmp,
    row_cmp	   => 1_row_cmp,
    lobcnt	   => 1_lobcnt,
    cmp_ratio      => 1_cmp_ratio,
    comptype_str   => 1_comptype_str,
    subset_numrows => DBMS_COMPRESSION.comp_ratio_lob_maxrows
   );
DBMS_OUTPUT.put_line( 'Number of blocks used by the compressed sample of the object    :  ' || 1_blkcnt_cmp);
DBMS_OUTPUT.put_line( 'Number of blocks used by the uncompressed sample of the object  :  ' || 1_blkcnt_uncmp);
DBMS_OUTPUT.put_line( 'Number of rows in a block in compressed sample of the object    :  ' || 1_row_cmp);
DBMS_OUTPUT.put_line( 'Number of LOBS actually sampled				      :  ' || 1_lobcnt);
DBMS_OUTPUT.put_line( 'Estimated Compression Ratio of Sample                           :  ' || 1_cmp_ratio);
DBMS_OUTPUT.put_line( 'Compression Type                                                :  ' || 1_comptype_str);
END;
/

拡張LOB圧縮(中)の圧縮アドバイザ見積りの出力:

Number of blocks used by the compressed sample of the object   : 199
Number of blocks used by the uncompressed sample of the object     : 389
Number of rows in a block in compressed sample of the object       : 293
Number of LOBS actually sampled 			               : 55
Estimated Compression Ratio of Sample			          : 1.9
Compression Type					                 : “Compress Medium”

次の例は、IOTの圧縮率を見積もる方法を示しています。

SET SERVEROUTPUT ON
DECLARE
  bcmp       INTEGER;
  buncmp     INTEGER;
  rowcmp     INTEGER;
  rowuncmp   INTEGER;
  cr         NUMBER;
  cstr       VARCHAR2(2000);
  iotcomp_cr DBMS_COMPRESSION.COMPRECLIST;
 BEGIN
    DBMS_COMPRESSION.GET_COMPRESSION_RATIO (
    scratchtbsname        => 'USERS',
    ownname               => 'TEST',
    objname               => 'SALES',
    subobjname            =>  NULL,
    comptype              =>  DBMS_COMPRESSION.COMP_INDEX_ADVANCED_LOW,
    iotcomp_cr            =>  iotcomp_cr,
    comptype_str          =>  cstr,
    subset_numrows        =>  DBMS_COMPRESSION.COMP_RATIO_ALLROWS
    ); 
 --information about the index and the overflow segment 
 DBMS_OUTPUT.put_line( 'Number of blocks used by the compressed sample of the IOT table                                    : ' || iotcomp_cr(1).blkcnt_cmp);
 DBMS_OUTPUT.put_line( 'Number of blocks used by the uncompressed sample of the IOT table                                  : ' || iotcomp_cr(1).blkcnt_uncmp);          
 DBMS_OUTPUT.put_line( 'Average number of rows in a block in the compressed sample of the IOT table                        : ' || iotcomp_cr(1).row_cmp);
 DBMS_OUTPUT.put_line( 'Average number of rows in a block in the uncompressed sample of the IOT table                      : ' || iotcomp_cr(1).row_uncmp);
 DBMS_OUTPUT.put_line( 'Estimated Compression Ratio of the sample                                                          : ' || iotcomp_cr(1).cmp_ratio);  
 --information about the index segment 
 DBMS_OUTPUT.put_line( 'Number of blocks used by the compressed sample of the index segment of the IOT table               : ' || iotcomp_cr(2).blkcnt_cmp);
 DBMS_OUTPUT.put_line( 'Number of blocks used by the uncompressed sample of the index segment of the IOT table             : ' || iotcomp_cr(2).blkcnt_uncmp);
 DBMS_OUTPUT.put_line( 'Average number of rows in a block in the compressed sample of the index segment of the IOT table   : ' || iotcomp_cr(2).row_cmp);
 DBMS_OUTPUT.put_line( 'Average number of rows in a block in the uncompressed sample of the index segment of the IOT table : ' || iotcomp_cr(2).row_uncmp);
 DBMS_OUTPUT.put_line( 'Estimated Compression Ratio of the sample                                                          : ' || iotcomp_cr(2).cmp_ratio);
 END;
 /

IOTの圧縮率の出力:

Number of blocks used by the compressed sample of the IOT table                                    : 5027
Number of blocks used by the uncompressed sample of the IOT table                                  : 7950
Average number of rows in a block in the compressed sample of the IOT table                        : 199
Average number of rows in a block in the uncompressed sample of the IOT table                      : 126
Estimated Compression Ratio of the sample                                                          : 1.58
Number of blocks used by the compressed sample of the index segment of the IOT table               : 3238
Number of blocks used by the uncompressed sample of the index segment of the IOT table             : 6161
Average number of rows in a block in the compressed sample of the index segment of the IOT table   : 309
Average number of rows in a block in the uncompressed sample of the index segment of the IOT table : 162
Estimated Compression Ratio of the sample                                                          : 1.9

次の例は、BasicFile LOBとSecureFile LOBの圧縮率を推定する方法を示しています。23cリリース以降、BasicFile LOBの圧縮率も推定できるようになりました。この例では、23cリリースで導入された新しいパラメータbyte_comp_ratiototal_timeの使用方法についても説明しています。

DECLARE
 bcmp   INTEGER;
 buncmp INTEGER;
 lobcmp INTEGER;
 cr     NUMBER;
 cstr   VARCHAR2(2000);
 byte_comp_ratio NUMBER;
 total_time NUMBER;
BEGIN
  DBMS_COMPRESSION.GET_COMPRESSION_RATIO (
    scratchtbsname      => 'SYSAUX',
    tabowner            => 'T',
    tabname             => 'T5',  
    lobname             => 'DATA',
    partname            => 'P1',
    comptype            => dbms_compression.COMP_LOB_MEDIUM,
    blkcnt_cmp          => bcmp,
    blkcnt_uncmp        => buncmp,
    lobcnt              => lobcmp,
    cmp_ratio           => cr,
    comptype_str        => cstr,
    subset_numrows      => -1,
    byte_comp_ratio     => byte_comp_ratio,
    total_time          => total_time
  );
  DBMS_OUTPUT.put_line('Estimated compression ratio of sample:                           '||cr);
  DBMS_OUTPUT.put_line('Number of blocks used by the uncompressed sample of the LOB:     '||buncmp);
  DBMS_OUTPUT.put_line('Estimated number of blocks used by compressed sample of the LOB: '||bcmp);
  DBMS_OUTPUT.put_line('Estimated compression ratio at the byte level:                   '||byte_comp_ratio);
  DBMS_OUTPUT.put_line('Estimated time to compress the LOB data in the table:            '||total_time|| ' hrs');
end;

BasicFile LOBとSecureFile LOBの圧縮率の出力。

Estimated compression ratio of sample:                     1
Number of blocks used by the uncompressed sample of the LOB:        1240
Estimated number of blocks used by compressed sample of the LOB:    1240
Estimated compression ratio at the byte level:                      1.36890022783308
Estimated time to compress the LOB data in the table:               .00005245645896343059487970173760270976565028 hrs

この例の出力では、圧縮の前後でブロック数は同じため、ブロック・レベルの圧縮率のcmp_ratioが1になります。ただし、圧縮の前後でLOBに使用される実際のバイト数を比較するバイト・レベルの圧縮率byte_comp_ratioは1.36になっています。たとえば、圧縮前のLOBが1000バイトを使用しているとします。バイト・レベルでの推定圧縮率は1.36です。これは、圧縮後のLOBには約736バイトが使用されることを示します。

使用上のノート

  • プロシージャは、スクラッチ表領域に異なる表を作成し、これらのオブジェクトで分析を実行します。ユーザー指定の表では何も変更しません。
  • 23c以降、この機能が拡張されていて、少ない領域の使用でLOBの圧縮率をより速く推定するようになりました。より正確な結果を得るには、次のコマンドを実行して古いメソッドに切り替えます。圧縮率を計算する古いメソッドでは、結果を返すまでに時間がかかり、より多くの領域が使用されます。

    alter session set "_kdlf_new_compression_adv"= FALSE;

46.5.2 GET_COMPRESSION_TYPEファンクション

このファンクションは、特定の行に対する圧縮タイプを戻します。行が連鎖している場合は、ファンクションは先頭の圧縮タイプのみを戻し、先頭は異なる圧縮が可能であるため、中間や末尾は調べません。

構文

DBMS_COMPRESSION.GET_COMPRESSION_TYPE (
   ownname      IN    VARCHAR2, 
   tabname      IN    VARCHAR2, 
   row_id       IN    ROWID,
   subobjname   IN    VARCHAR2 DEFAULT NULL))
  RETURN NUMBER;

パラメータ

表46-5 GET_COMPRESSION_TYPEファンクションのパラメータ

パラメータ 説明

ownname

表のスキーマ名。

tabname

表の名前。

rowid

行のROWID。

subobjname

表パーティションまたは表サブパーティションの名前。

戻り値

圧縮タイプを示すフラグ(表46-1を参照)。