Manage partition retention time
You can keep the size of the Hive metadata and data you accumlate for log processing, and other activities, to a manageable size by setting a retention period for the data.
- ms (milliseconds)
- s (seconds)
- m (minutes)
- d (days)
In this task, you configure automatic synchronization of the file system partitions
with the metastore and a partition retention period. Assume you already created a
partitioned, external table named
employees as described earlier (see link below).
If necessary, enable automatic discovery of partitions for the table
ALTER TABLE employees SET TBLPROPERTIES ('discover.partitions'='true');By default, external partitioned tables already set this table property to true.
Configure a partition retention period of one week.
ALTER TABLE employees SET TBLPROPERTIES ('partition.retention.period'='7d');The partition metadata as well as the actual data for
employeesin Hive is automatically dropped after a week.