Launch price: every exam for $29.99 a year, for the first 300 buyers. See the price

CertStreak
Menu

Apply data retention policies

A worked example

Complete the statement

The Unity Catalog table main.crm.customers has deletion vectors enabled. A customer submits a right-to-be-forgotten request, and you run:

DELETE FROM main.crm.customers WHERE customer_id = 1042;

The compliance team requires that the customer's rows are physically removed from the underlying storage, not only hidden from queries.

Complete the sequence of commands to run after the DELETE statement.

First run . After waiting for the table's deleted-file retention period to elapse following the purge, run .

  • Blank 1: REORG TABLE main.crm.customers APPLY (PURGE) (correct answer)

    REORG TABLE ... APPLY (PURGE) rewrites files containing rows marked as deleted by deletion vectors. VACUUM alone cannot purge those rows from files still referenced by the table. ANALYZE updates statistics, while SHOW TBLPROPERTIES displays settings; neither rewrites the affected files.

  • Blank 2: VACUUM main.crm.customers (correct answer)

    VACUUM permanently removes the replaced, unreferenced files after their retention period expires. Repeating REORG does not remove those historical files. ANALYZE updates statistics, and SHOW TBLPROPERTIES displays settings; neither deletes the files.

Why

Deletion vectors can leave deleted rows physically present in Parquet files while hiding them from queries. REORG TABLE ... APPLY (PURGE) rewrites the affected files without those rows, but the replaced files remain in storage. Wait for the retention period to expire after the purge, then run VACUUM to delete those historical files.

Practise this topic until it's automatic.

Ten questions a day, every answer explained, and misses that come back until you beat them.

Start free