You manually start
compaction when automatic compaction fails for some reason. You can start compaction by
running a Hive statement.
Carefully consider the need for a major compaction as this process can consume
significant system resources and take a long time. Start a major compaction during
periods of low traffic. Base and delta files for a table or partition are compacted.
Start compaction using a query
You use the following syntax to
issue a query that starts
compaction: ALTER TABLE tablename [PARTITION (partition_key='partition_value' [,...])] COMPACT 'compaction_type'
Tables or partitions you are compacting must be full ACID or insert-only ACID
tables.
-
In Cloudera Manager, select the Hive metastore service: .
-
Search for
compact
.
-
Check that the Hive Metastore Server Default Group is selected
(
hive.compactor.initiator.on=true
).
-
Execute a query to start a major compaction of a table.
ALTER TABLE mytable COMPACT 'major'
ALTER TABLE
compacts tables even if the NO_AUTO_COMPACTION table property is set.