SYS_ANALYZE_COMPRESSION_HISTORY - Amazon Redshift

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

SYS_ANALYZE_COMPRESSION_HISTORY

記錄COPY或ANALYZECOMPRESSION指令期間的壓縮分析作業的詳細資料。

SYS_ _ ANALYZE COMPRESSION _ HISTORY 對所有用戶都可以看到。超級使用者可以看見所有資料列;一般使用者只能看見自己的資料。如需詳細資訊,請參閱系統資料表和檢視中資料的可見性

資料表欄

欄名稱 資料類型 描述
user_id integer 產生項目的使用者之 ID。
start_time timestamp 壓縮分析操作開始進行的時間。
transaction_id bigint 壓縮分析操作的交易 ID。
table_id integer 接受分析之資料表的 ID。
table_name character(128) 接受分析之資料表的名稱。
column_position integer 接受分析之資料表的資料欄索引,用於判斷壓縮編碼。
old_encoding character(15) 壓縮分析之後的編碼類型。
new_encoding character(15) 壓縮分析之後的編碼類型。
模式 character(14)

可能值如下:

PRESET

指定new_encoding由 Amazon Redshift COPY 命令根據資料行資料類型決定。不會對任何資料取樣。

ON

指定new_encoding由 Amazon Redshift COPY 命令根據範例資料的分析來決定。

ANALYZE ONLY

指定new_encoding由 Amazon Redshift ANALYZE COMPRESSION 命令根據範例資料的分析來決定。然而,不會變更已分析資料欄的編碼類型。

範例查詢

下列範例會透過在相同工作階段中執行的最後一個COPY命令,檢查資料lineitem表上的壓縮分析詳細資料。

select transaction_id, table_id, btrim(table_name) as table_name, column_position, old_encoding, new_encoding, mode from sys_analyze_compression_history where transaction_id = (select transaction_id from sys_query_history where query_id = pg_last_copy_id()) order by column_position; transaction_id | table_id | table_name | column_position | old_encoding | new_encoding | mode -----------------+-------------+------------+-----------------+-----------------+-----------------+------------- 8196 | 248126 | lineitem | 0 | mostly32 | mostly32 | ON 8196 | 248126 | lineitem | 1 | mostly32 | lzo | ON 8196 | 248126 | lineitem | 2 | lzo | delta32k | ON 8196 | 248126 | lineitem | 3 | delta | delta | ON 8196 | 248126 | lineitem | 4 | bytedict | bytedict | ON 8196 | 248126 | lineitem | 5 | mostly32 | mostly32 | ON 8196 | 248126 | lineitem | 6 | delta | delta | ON 8196 | 248126 | lineitem | 7 | delta | delta | ON 8196 | 248126 | lineitem | 8 | lzo | zstd | ON 8196 | 248126 | lineitem | 9 | runlength | zstd | ON 8196 | 248126 | lineitem | 10 | delta | lzo | ON 8196 | 248126 | lineitem | 11 | delta | delta | ON 8196 | 248126 | lineitem | 12 | delta | delta | ON 8196 | 248126 | lineitem | 13 | bytedict | zstd | ON 8196 | 248126 | lineitem | 14 | bytedict | zstd | ON 8196 | 248126 | lineitem | 15 | text255 | zstd | ON (16 rows)