Purging in Apache Hive

Purge in Apache Hive aids in the permanent deletion of data. This will be used with the DROP TABLE statement. This can also be used for deleting certain partitions. However, this keyword should be used with caution since if a table or partition is accidentally deleted, it cannot be retrieved.

Table Level:
If you don’t use purge, the table is moved in the Trash directory, where it can be recovered after being dropped. However, if you use purge, the table will not travel to the Trash directory and will not be recoverable.

Partition Level:
ALTER TABLE DROP PARTITION can be used to remove a table partition. This deletes the partition’s data and metadata. Unless PURGE is given, the data is moved to the Trash/Current directory if Trash is set, but the metadata is completely destroyed.


ALTER TABLE table_name DROP [IF EXISTS] PARTITION [partition_spec]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s