

 Amazon Redshift は、パッチ 198 以降、新しい Python UDF の作成をサポートしなくなります。既存の Python UDF は、2026 年 6 月 30 日まで引き続き機能します。詳細については、[ブログ記事](https://aws.amazon.com/blogs/big-data/amazon-redshift-python-user-defined-functions-will-reach-end-of-support-after-june-30-2026/)を参照してください。

# STL\_ANALYZE\_COMPRESSION
<a name="r_STL_ANALYZE_COMPRESSION"></a>

COPY または ANALYZE COMPRESSION コマンドの実行中に圧縮分析オペレーションの詳細を記録します。

STL\_ANALYZE\_COMPRESSION はすべてのユーザーに表示されます。スーパーユーザーはすべての行を表示できますが、通常のユーザーは自分のデータのみを表示できます。詳細については、「[システムテーブルとビューのデータの可視性](cm_chap_system-tables.md#c_visibility-of-data)」を参照してください。

このテーブルの一部またはすべてのデータは、SYS モニタリングビュー [SYS\_ANALYZE\_COMPRESSION\_HISTORY](r_SYS_ANALYZE_COMPRESSION_HISTORY.md) でも確認できます。SYS モニタリングビューのデータは、使いやすく理解しやすいようにフォーマットされます。クエリには、SYS モニタリングビューを使用することをお勧めします。

## テーブルの列
<a name="r_STL_ANALYZE_COMPRESSION-table-columns2"></a>


| 列名  | データ型  | 説明  | 
| --- | --- | --- | 
| userid | integer | エントリを生成したユーザーの ID。 | 
| start\_time | timestamp | 圧縮分析オペレーションを開始した時刻。 | 
| xid | bigint | 圧縮分析オペレーションのトランザクション ID。 | 
| tbl | integer | 分析されたテーブルのテーブル ID。 | 
| tablename | character(128) | 分析されたテーブルの名前。 | 
| col | integer | 圧縮エンコードを決定するために分析されたテーブルの列のインデックス。 | 
| old\_encoding | character(15) | 圧縮分析前のエンコードタイプ。 | 
| new\_encoding | character(15) | 圧縮分析後のエンコードタイプ。 | 
| mode | character(14) | [See the AWS documentation website for more details](http://docs.aws.amazon.com/ja_jp/redshift/latest/dg/r_STL_ANALYZE_COMPRESSION.html)  | 
| best\_compression\_encoding | character(15) | 最適な圧縮率を提供するエンコードタイプ。 | 
| recommended\_bytes | character(15) | 新しいエンコードを採用して使用されたバイト数。 | 
| best\_compression\_bytes | character(15) | 最適なエンコードを採用して使用されたバイト数。 | 
| ndv | bigint | サンプリングされた行内の異なる値の数。 | 

## サンプルクエリ
<a name="r_STL_ANALYZE_COMPRESSION-sample-queries2"></a>

次の例では、同じセッションで実行された最後の COPY コマンドで、`lineitem` テーブルの圧縮分析の詳細を検査します。

```
select xid, tbl, btrim(tablename) as tablename, col, old_encoding, new_encoding, best_compression_encoding, mode 
from stl_analyze_compression 
where xid = (select xid from stl_query where query = pg_last_copy_id()) order by col;

 xid  |  tbl   | tablename | col |  old_encoding   |  new_encoding   | best_compression_encoding |      mode      
------+--------+-----------+-----+-----------------+-----------------+---------------------------+----------------
 5308 | 158961 | $lineitem |   0 | mostly32        | az64            | delta                     | ON            
 5308 | 158961 | $lineitem |   1 | mostly32        | az64            | az64                      | ON            
 5308 | 158961 | $lineitem |   2 | lzo             | az64            | az64                      | ON            
 5308 | 158961 | $lineitem |   3 | delta           | az64            | az64                      | ON            
 5308 | 158961 | $lineitem |   4 | bytedict        | az64            | bytedict                  | ON            
 5308 | 158961 | $lineitem |   5 | mostly32        | az64            | az64                      | ON            
 5308 | 158961 | $lineitem |   6 | delta           | az64            | az64                      | ON            
 5308 | 158961 | $lineitem |   7 | delta           | az64            | az64                      | ON            
 5308 | 158961 | $lineitem |   8 | lzo             | lzo             | lzo                       | ON            
 5308 | 158961 | $lineitem |   9 | runlength       | runlength       | runlength                 | ON            
 5308 | 158961 | $lineitem |  10 | delta           | az64            | az64                      | ON            
 5308 | 158961 | $lineitem |  11 | delta           | az64            | az64                      | ON            
 5308 | 158961 | $lineitem |  12 | delta           | az64            | az64                      | ON            
 5308 | 158961 | $lineitem |  13 | bytedict        | bytedict        | bytedict                  | ON            
 5308 | 158961 | $lineitem |  14 | bytedict        | bytedict        | bytedict                  | ON            
 5308 | 158961 | $lineitem |  15 | text255         | text255         | text255                   | ON   
(16 rows)
```