Topic 1 Question 127
A data engineer maintains a materialized view that is based on an Amazon Redshift database. The view has a column named load_date that stores the date when each row was loaded.
The data engineer needs to reclaim database storage space by deleting all the rows from the materialized view.
Which command will reclaim the MOST database storage space?
DELETE FROM materialized_view_name where 1=1
TRUNCATE materialized_view_name
VACUUM table_name where load_date<=current_date materializedview
DELETE FROM materialized_view_name where load_date<=current_date
ユーザの投票
コメント(6)
- 正解だと思う選択肢: A
Why this is the best option: Efficiency: By using "WHERE 1=1", the database doesn't need to iterate through each row individually to check a specific condition, resulting in faster deletion of all data. Storage reclamation: Deleting all rows using this method will free up the most storage space within the materialized view. Important Considerations: TRUNCATE vs DELETE: While "TRUNCATE" can also be used to remove all data from a table, it is not recommended for materialized views in Redshift as it might not always reclaim all the storage space effectively. VACUUM command: "VACUUM" is used to reclaim space within a table after deletions, but it's not necessary when deleting all rows using "DELETE FROM ... WHERE 1=1;" as the entire table will be emptied.
👍 3A_E_M2025/01/20 - 正解だと思う選択肢: A
(B) TRUNCATE is invalid for materialized views, so it is excluded. In actual operations, to most effectively reuse storage, you need to delete all rows with a DELETE statement and then run VACUUM, as shown in (A) or (D). If you want to delete everything, option (A) is the most straightforward approach.
👍 2YUICH2025/01/26 - 正解だと思う選択肢: B
the key is "reclaim database storage space" Delete does not reclaim disk space
👍 2JimOGrady2025/03/03
シャッフルモード