You can use vacuum tables to recover disk space and sorts rows in a specified table or all tables in the database.
After you run bulk operations, such as delete or load, or after you run incremental updates, you must clean the database tables to recover disk space and to improve query performance on Amazon Redshift. Amazon Redshift does not reclaim and reuse free space when you delete and update rows.
Vacuum databases or tables often to maintain consistent query performance. You can recover disk space for the entire database or for individual tables in a database. You must run vacuum when you expect minimal activity on the database or during designated database administration schedules. Long durations of vacuum might impact database operations. Run vacuum often because large unsorted regions result in longer vacuum times.
You can enable the vacuum tables option when you configure the advanced target properties. You can select the following recovery options:
Does not sort rows or recover disk space.
Sorts the specified table or all tables in the database and recovers disk space occupied by rows marked for deletion by previous update and delete operations.
Sorts the specified table or all tables in the database without recovering space freed by deleted rows.
Recovers disk space occupied by rows marked for deletion by previous update and delete operations, and compresses the table to free up used space.