Tech challenge · AWS

Every Athena query scans 2 TB

EasyAWS

Analysts query one day of clickstream data in Athena, and every query scans about 2 TB and costs accordingly. The data is gzipped CSV in one S3 prefix. List the changes that cut the bytes scanned, in order of impact.

Think it through or sketch an answer first, then open the hint or the solution.

Show a hint

Athena charges by data scanned. Ask how to read fewer files and fewer bytes of each file.

Show the solution

Partition the data by date (for example dt=2026-03-01/) and filter on the partition column, so Athena reads only that day; partition projection avoids managing partitions by hand. Convert to a columnar format such as Parquet with compression, so queries read only the columns they use. Then select specific columns instead of SELECT *, and compact small files.

Common mistakes

  • Partitioning by a high-cardinality column such as user_id, which creates millions of tiny partitions.
  • Filtering on a timestamp column instead of the partition column, so no partitions are pruned.

Learn more

More AWS challenges

Today's challenge and the full archive