STL_ANALYZE_COMPRESSION - Amazon Redshift

STL_ANALYZE_COMPRESSION

Records details for compression analysis operations during COPY or ANALYZE COMPRESSION commands.

This table is visible to all users. Superusers can see all rows; regular users can see only their own data. For more information, see Visibility of data in system tables and views.

Table columns

Column name Data type Description
userid integer The ID of the user who generated the entry.
start_time timestamp The time when the compression analysis operation started.
xid bigint The transaction ID of the compression analysis operation.
tbl integer The table ID of the table that was analyzed.
tablename character(128) The name of the table that was analyzed.
col integer The index of the column in the table that was analyzed to determine the compression encoding.
old_encoding character(15) The encoding type before compression analysis.
new_encoding character(15) The encoding type after compression analysis.
mode character(14)

The possible values are:

PRESET

Specifies that the new_encoding is determined by the Amazon Redshift COPY command based on the column data type. No data is sampled.

ON

Specifies that the new_encoding is determined by the Amazon Redshift COPY command based on an analysis of sample data.

ANALYZE ONLY

Specifies that the new_encoding is determined by the Amazon Redshift ANALYZE COMPRESSION command based on an analysis of sample data. However, the encoding type of the analyzed column is not changed.

Sample queries

The following example inspects the details of compression analysis on the lineitem table by the last COPY command run in the same session.

select xid, tbl, btrim(tablename) as tablename, col, old_encoding, new_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 | 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)