DEA-C01 Practice Question 68: Redshift Deleted Rows Vacuum
AWS Certified Data Engineer – Associate (DEA-C01) · Test 7 · question 8 of 10
A monthly purge job deletes about 40% of the rows from a very large Amazon Redshift table. Afterward, the table's storage use has not dropped and queries against it are slower than before. The cluster runs heavy workloads around the clock, and the automatic background clean-up appears to make little progress. What should the data engineer do?
Show answer and explanation
Answer:
In Redshift, *"when you perform a delete, the rows are marked for deletion, but not removed."* Redshift runs an automatic VACUUM DELETE in the background, but it *"schedules the VACUUM DELETE to run during periods of reduced load and pauses the operation during periods of high load."* On a cluster that is always busy, the automatic operation may rarely run, so the engineer should run VACUUM (for example VACUUM DELETE ONLY) on the affected table when activity is low. AWS advises vacuuming individual tables as needed, since vacuuming a whole database can be expensive (option C).
- A is wrong because ANALYZE refreshes statistics for the query planner. It does not remove rows marked for deletion or free their space. - B is wrong because adding nodes adds capacity and cost. The deleted rows would still occupy blocks and still be scanned. - D is wrong because a sort key setting decides how data is ordered. It does not by itself remove rows that are marked for deletion.
Reference: Vacuuming tables