Compacting a database removes deleted documents and previous revisions. It is an irreversible operation and may take a while to complete for large databases.