Amazon Athena Performance: Compacting Small Files and Using Parquet
A data engineer is analyzing a large dataset stored in Amazon S3 using AWS Glue and Amazon Athena. They notice that queries against a table with many small files are slow. Which TWO actions can improve query performance?
Quick Answer
The answer is to compact small files into larger ones and use partitioning to limit data scanned. Amazon Athena query optimization for small files hinges on reducing the overhead caused by numerous tiny objects in S3, as each file requires a separate read operation and metadata lookup. By compacting these files into fewer, larger chunks, you minimize the number of S3 GET requests and improve throughput. Partitioning further accelerates performance by pruning the data scanned, so Athena only reads relevant subsets rather than the entire table. On the AWS Certified Machine Learning Specialty MLS-C01 exam, this scenario tests your understanding of how data layout directly impacts query latency, often appearing as a trap where candidates mistakenly choose converting to Parquet alone—while columnar formats help, the question explicitly asks for two actions, and compacting plus partitioning is the correct pair. Remember the mnemonic: “Big and sliced, queries are priced right”—big files reduce overhead, and slicing with partitions cuts scan costs.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Convert files to Apache Parquet format
Converting files to Apache Parquet format (C) improves query performance by leveraging columnar storage, which reduces the amount of data scanned and provides better compression. Using a larger number of partitions (E) allows Athena to perform partition pruning, limiting the data scanned per query. These two actions together reduce the volume of data processed and improve query speed, unlike increasing Glue DPUs (irrelevant for Athena), using automatic compression (not a distinct action), or decreasing partitions (increases scanned data).
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use Athena's automatic compression
Why it's wrong here
Athena does not have a configurable automatic compression feature for stored data; compression is achieved via file format (e.g., Parquet) and is not a separate action.
- ✗
Increase the number of Glue DPUs
Why it's wrong here
Glue DPUs are used for Glue ETL jobs, not for Athena queries. Increasing DPUs does not affect Athena performance.
- ✓
Convert files to Apache Parquet format
Why this is correct
Parquet is a columnar format that reduces data scanned and improves compression, leading to faster queries.
- ✗
Decrease the number of partitions
Why it's wrong here
Decreasing partitions increases the amount of data scanned per query, which slows performance.
- ✓
Use a larger number of partitions
Why this is correct
A larger number of partitions allows Athena to prune more data using partition filtering, reducing the data scanned and improving query speed.
Quick reference
AWS S3 Storage Class Comparison
| Storage Class | Min Duration | Retrieval | Use Case |
|---|---|---|---|
| S3 Standard | None | Immediate | Frequently accessed data |
| S3 Standard-IA | 30 days | Immediate | Infrequent access, rapid retrieval |
| S3 One Zone-IA | 30 days | Immediate | Non-critical infrequent data |
| S3 Intelligent-Tiering | None | Immediate–hours | Unknown or changing access patterns |
| S3 Glacier Instant | 90 days | Milliseconds | Archive with instant retrieval |
| S3 Glacier Flexible | 90 days | Minutes–hours | Archive, flexible retrieval |
| S3 Glacier Deep Archive | 180 days | Hours | Long-term compliance archive |
Go deeper
Related to this question
About these practice questions
Courseiva writes every MLS-C01 question from scratch — 1,672 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
Same concept, more angles
2 more ways this is tested on MLS-C01
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. A data engineer is exploring a large dataset in Amazon Athena. The dataset is partitioned by date and stored in Parquet format. The engineer wants to check the number of distinct values in a column for a specific date range. Which THREE practices reduce query cost and improve performance?
medium- ✓ A.Use the COUNT(DISTINCT column) function.
- ✓ B.Filter the query with a WHERE clause on the partition column.
- C.Use ORDER BY to sort the results.
- D.Use SELECT * to retrieve all columns.
- ✓ E.Ensure the table is columnar (Parquet) to reduce I/O.
Why A: Options A, B, and E are correct. Using COUNT(DISTINCT column) (A) is a precise way to count distinct values, and while it scans the column, it avoids fetching unnecessary data. Filtering with a WHERE clause on the partition column (B) limits the data scanned to only the relevant partitions, significantly reducing cost and improving performance. Using a columnar format like Parquet (E) reduces I/O by reading only the required columns. Option C (ORDER BY) is incorrect because it requires sorting the entire result set, increasing processing time and cost. Option D (SELECT *) is incorrect as it retrieves all columns, negating the benefits of columnar storage and increasing data scanned.
Variation 2. A data scientist runs a SQL query on an Amazon Athena table and notices that the query scans a large amount of data. Which approach would reduce the amount of data scanned without changing the SQL logic?
easy- ✓ A.Partition the table on a column that is frequently used in WHERE clauses.
- B.Convert the data from CSV to JSON format.
- C.Store the data in Parquet format without partitioning.
- D.Use GZIP compression on the data files.
Why A: Partitioning the table on a column that is frequently used in WHERE clauses allows Athena to prune partitions and only scan the relevant data, reducing the amount of data scanned. Option B (JSON) does not reduce scan because it is not columnar. Option C (Parquet without partitioning) is columnar and can reduce scan through column pruning, but without partitioning it still scans entire columns. Option D (GZIP) compresses data but Athena decompresses and scans the full file size, so no reduction in scanned data.
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This MLS-C01 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the MLS-C01 exam.