awsathenaanalyticscost-optimization

Athena partitioning cost savings: pay for less scanned data

Athena charges $5 per terabyte scanned, so the whole cost game is scanning less. Partitioning, columnar formats, and compression can cut the data a query reads by 10 to 100 times. Here is how each lever works and how they stack to slash an Athena bill.

The C3X Team··6 min read

Quick answer

Athena bills about $5 per terabyte of data scanned, with a 10 MB minimum per query, so cost is a direct function of bytes read, not query complexity or time. The three levers that cut bytes scanned are partitioning (so queries skip irrelevant data by date, region, or other keys), columnar formats like Parquet or ORC (so a query reads only the columns it selects), and compression (so each column is smaller). Combined, they routinely reduce scanned data by 10 to 100 times, turning a $50 query into pennies. Partition projection avoids per-partition catalog lookups on large tables.

Athena's pricing is refreshingly simple and unforgiving: about $5 per terabyte of data scanned, with a 10 MB minimum per query. There is no charge for compute time, query complexity, or idle capacity, only for the bytes a query reads from S3. That means every optimization is really the same optimization: make each query scan less data. Partitioning, columnar formats, and compression are the three tools for doing exactly that.

Why bytes scanned is everything

A query that scans a 1 TB uncompressed CSV table costs about $5, every time it runs. Run it a thousand times a day across a team's dashboards and that is $5,000 a day for one poorly-stored table. The same logical data stored and queried efficiently might scan 10 GB, costing 5 cents per run. Nothing about the query changed; only how much data it had to read. This is why storage layout, not query tuning, is where Athena savings live.

Partitioning: skip irrelevant data

Partitioning organizes data in S3 by keys such as date, region, or customer, so a query filtered on those keys reads only the matching partitions instead of the whole table. A table partitioned by day, queried for a single day out of two years, scans roughly 1/730th of the data. The saving is proportional to how selective the partition filter is. The key discipline is that queries must filter on the partition column to benefit; a query with no partition predicate scans everything regardless.

OptimizationTypical reduction in scanned data
Partition by date (query 1 day of 2 years)~700x
Parquet vs CSV (select 3 of 30 columns)~10x
Compression (Snappy/Gzip)~3 to 5x

Columnar formats and compression

Converting data from row formats like CSV or JSON to columnar formats like Parquet or ORC means Athena reads only the columns a query selects, not every column of every row. A query selecting 3 of 30 columns scans roughly a tenth of the data. Columnar formats also compress far better, and compression (Snappy, Gzip, Zstd) shrinks each column further, cutting bytes read another 3 to 5 times. Because these stack multiplicatively with partitioning, the combined effect is often 50 to 100 times less data scanned than raw CSV, and a proportional cost cut. See Athena cost optimization for the fuller treatment.

Partition projection for large tables

On tables with many partitions, Athena normally queries the Glue Data Catalog to find the relevant ones, which adds latency and, at scale, catalog request cost. Partition projection lets Athena compute partition locations from a defined pattern instead of looking them up, which speeds queries and avoids the per-partition catalog overhead on tables with thousands of partitions. It is a configuration change that helps both performance and the Glue catalog cost covered in Glue crawler cost.

Store for the query, not the write

Athena cost is decided at storage time, not query time. Data landed as compressed, partitioned Parquet costs a fraction of the same data left as raw CSV, no matter how the queries are written. Convert high-traffic tables to columnar, partition on the columns queries filter by, compress everything, and use partition projection on large tables. Price your data-lake layout and query patterns against the resource catalog and data-lake cost optimization so queries scan gigabytes, not terabytes.

FAQ

How does Athena charge for queries?

About $5 per terabyte of data scanned, with a 10 MB minimum per query, in us-east-1. There is no charge for compute time, query complexity, or idle capacity, only for the bytes read from S3. That makes every cost optimization the same goal: make each query scan less data through partitioning, columnar formats, and compression.

How much does partitioning save on Athena?

The saving is proportional to how selective the partition filter is. A table partitioned by day and queried for one day out of two years scans about 1/730th of the data, roughly a 700x reduction and a 700x cost cut for that query. Queries must filter on the partition column to benefit; without a partition predicate they scan everything.

Why does converting to Parquet reduce Athena cost?

Parquet and ORC are columnar, so Athena reads only the columns a query selects rather than every column of every row. A query selecting 3 of 30 columns scans about a tenth of the data. Columnar formats also compress better, and compression cuts bytes read another 3 to 5 times, stacking with partitioning for 50 to 100x total reductions.

What is Athena partition projection?

A feature that lets Athena compute partition locations from a defined pattern instead of looking them up in the Glue Data Catalog. On tables with thousands of partitions, this speeds queries and avoids per-partition catalog overhead and request cost, improving both query performance and the associated Glue catalog cost.

How does C3X help with Athena cost?

C3X prices the storage and data-lake resources behind Athena from Terraform, including S3 buckets, storage classes, and Glue catalog configuration, so the layout that determines scanned-data cost is visible before deploy. That helps teams commit to partitioned, columnar, compressed storage at design time rather than discovering expensive full-table scans on the Athena bill.

What to do next

Store data so queries scan gigabytes, not terabytes. C3X prices your data-lake layout from Terraform against a live resource catalog. Start with the quickstart.

Try C3X on your own Terraform

Free and open source. No API key required. One command to install, one command to estimate.