AWS Certified Data Engineer - Associate (DEA-C01) free question 6 / 10 · Domain 2: Data Store Management
A team must export the result of a Redshift query to an S3 data lake so that Athena can query it cheaply and prune data by year and month. Which UNLOAD configuration fits this goal?
- Unload with the default settings, which write columnar files that Athena can read without scanning unneeded columns
- Unload in Apache Parquet format with PARTITION BY on the year and month columns, which writes year= and month= folders
- Unload in Parquet with PARALLEL OFF, so that the result is written serially into one large file for Athena
- Unload as text with a MANIFEST file, which lists the files so that Athena queries the files of one month
Show the answer and explanation
Answer: B
Why this is correct
UNLOAD writes pipe-delimited text by default. For an S3 data lake, Parquet is an efficient open columnar format, and the page says it is up to 2x faster to unload and takes up to 6x less storage than text formats. The PARTITION BY clause automatically partitions output files into partition folders such as year=2019/month=September, following the Apache Hive convention. Athena can use those folders to skip the data of other months.
Why the other options are wrong
"Unload with the default settings, which write columnar files that Athena can read without scanning unneeded columns" … By default the unloaded file format is pipe-delimited text, not a columnar format. Parquet is the format that is up to 2x faster to unload and takes up to 6x less storage than text formats.
"Unload in Parquet with PARALLEL OFF, so that the result is written serially into one large file for Athena" … PARALLEL OFF writes the data serially, and a file can be as large as 6.2 GB. A serial single file does not create the year and month folders that let a query skip data.
"Unload as text with a MANIFEST file, which lists the files so that Athena queries the files of one month" … The manifest explicitly lists the data files that UNLOAD created. It does not split the output into partition folders and does not change the text format.
Key points
Partition columns are not included in the output files unless you add the INCLUDE option. The partition columns must be in the SELECT list of the UNLOAD query.