To do that we must search for columns that are not being compressed, and we can alter the column compression using alter statement :ĪLTER TABLE tablename ALTER COLUMN column_name ENCODE new_encode_type When creating a Redshift table sometimes we miss out on providing column compression strategy, it causes the data stored without being compressed and increases the size of the table. Column compression conserves storage space and reduces the disk I/O utilization because it scans fewer data blocks on the disk. Choose the right column compressionĪmazon Redshift is a columnar database, which means each Data Blocks store the value of a single column for multiple rows. Tables with interleaved sort key can not be altered for both Alter distyle and Alter Sort key. Note: There are restrictions when altering distribution style and sort key. Example of alter statement :ĪLTER TABLE tablename ALTER DISTSTYLE ALL ĪLTER TABLE tablename ALTER SORTKEY (column_list) Multiple columns can be defined as interleaved sort key and it gives equal weight to each column, if the query has fixed columns in the filter clause, applying interleaved sort key is best suited to improve performance.ĭistribution style and sort key are defined at table creation, but they can be altered later after table creation. There are 2 types of sort keys :ĭata sorted based on order listed in table sort key definition. Choosing the right sort key can improve query performance because it allows the query planner to scan fewer data when doing a filter, join, group, and order operations. Sort key in Redshift determines how data to be sorted based on the key defined. In general : Small tables are distributed with ALL strategies, and large tables are distributed with EVEN strategy.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |