Amazon Redshift 自 2025 年 11 月 1 日起不再支援建立新的 Python UDF。如果您想要使用 Python UDF,請在該日期之前建立 UDF。現有 Python UDF 將繼續正常運作。如需詳細資訊,請參閱部落格文章
STL_ANALYZE_COMPRESSION
記錄在 COPY 或 ANALYZE COMPRESSION 命令期間的壓縮分析操作詳細資訊。
所有使用者都可看見 STL_ANALYZE_COMPRESSION。超級使用者可以看見所有資料列;一般使用者只能看見自己的資料。如需更多詳細資訊,請參閱 系統資料表和檢視中資料的可見性。
此資料表中的部份或所有資料也會在 SYS 監控檢視 SYS_ANALYZE_COMPRESSION_HISTORY 中找到。SYS 監視檢視中的資料會格式化為更易於使用和理解。我們建議您使用 SYS 監控檢視進行查詢。
資料表欄
| 欄名稱 | 資料類型 | 說明 |
|---|---|---|
| userid | integer | 產生項目的使用者之 ID。 |
| start_time | timestamp | 壓縮分析操作開始進行的時間。 |
| xid | bigint | 壓縮分析操作的交易 ID。 |
| tbl | integer | 接受分析之資料表的 ID。 |
| 資料表名稱 | character(128) | 接受分析之資料表的名稱。 |
| col | integer | 接受分析之資料表的資料欄索引,用於判斷壓縮編碼。 |
| old_encoding | character(15) | 壓縮分析之後的編碼類型。 |
| new_encoding | character(15) | 壓縮分析之後的編碼類型。 |
| 模式 | character(14) | 可能值如下:
|
| best_compression_encoding | character(15) | 提供最佳壓縮比率的編碼類型。 |
| recommended_bytes | character(15) | 採用新編碼所使用的位元組。 |
| best_compression_bytes | character(15) | 採用最佳壓縮編碼所使用的位元組。 |
| ndv | bigint | 取樣列中不同值的數目。 |
範例查詢
下列範例由在相同工作階段中執行的最後一項 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)