1. A data engineer is working with a large Delta table `transactions` that is frequently queried with filters on `customer_id` and `transaction_date`. The table currently has many small Parquet files due to frequent streaming micro-batch writes. The engineer runs: ```sql OPTIMIZE transactions ZORDER BY (customer_id, transaction_date); ``` Which TWO outcomes should the engineer expect after this command completes? (Select TWO.)
- A. Small Parquet files are compacted into larger files, reducing the number of files in the table.✓ Correct
- B. Old versions of the table are automatically removed and storage is immediately reclaimed.
- C. Data is co-located within each compacted file so that records with similar `customer_id` and `transaction_date` values are stored together, improving data skipping.✓ Correct
- D. The command rewrites all data in fully sorted order globally across all files, like a traditional database sort.
- E. Future streaming micro-batch writes will automatically apply Z-ORDER to new files as they arrive.
- F. Query performance for filters on `customer_id` and `transaction_date` is improved by allowing the engine to skip more files using column statistics.
Explanation
**Option A** is correct: OPTIMIZE compacts small files into larger, more efficiently sized Parquet files, which directly addresses the small-file problem caused by streaming micro-batches. **Option C** is also correct and closely related: Z-ORDER co-locates data within compacted files so that records with similar values of the Z-ORDER columns are physically near each other, enabling the Delta engine to skip more files during queries filtered on those columns. Option B is incorrect — OPTIMIZE does not delete old file versions; that requires a separate VACUUM command. Option D is incorrect — Z-ORDER is a multi-dimensional clustering technique, not a global sort; it co-locates similar values within files but does not produce a globally sorted table. Option E is incorrect — OPTIMIZE/Z-ORDER is a one-time operation on existing data; new files written by future streaming jobs are not automatically Z-ORDERed. Option F is partially correct in describing the *benefit* but is essentially a restatement of C — the mechanism (co-location enabling file skipping via statistics) is what C describes, so C captures the correct underlying outcome.