Topic lessonTopic: SQL Server recovery and analytics data
Athena scanned bytes and S3 costs: compare equivalent results
Compare scans and other charges only after matching the business result. Separate columns from partitions and relate bytes read to the report produced.
Separate columns from partitions and relate bytes read to the report produced.
This fictional measurement assumes scan-based Athena SQL pricing. No current prices or live queries are used.
Measure scans and storage separately
With scan-based Athena SQL pricing, the amount of data scanned affects the charge. Consider S3 storage and requests separately.
- Business question → LayoutFix the output conditions
- Layout → Data scannedObserve bytes read
- Data scanned → Cost viewAdd separate costs
- Business question
- Same day and columns
- Layout
- Date partitioning and columnar data
- Data scanned
- Different volumes for the same result
- Cost view
- Separate scan and storage
Explain the drop from 40 GB to 2 GB
| Layout and query | Scanned | What changed |
|---|---|---|
| Unpartitioned CSV | 40 GB | Data outside the target day can be read |
| Date-partitioned CSV with date filter | 8 GB | Matching partitions are selected |
| Date-partitioned Parquet with required columns | 2 GB | Column and layout effects |
| Keep both versions temporarily | Separate from scans | S3 storage can grow during migration |
A partition condition limits partitions read. Columnar formats can reduce the columns read. The reduction from 40 GB to 2 GB for the same result is 95%.
Compare measurements under matching conditions
Choose the measurements. Record bytes scanned, frequency, wait time, S3 storage and S3 requests separately.
Change conditions deliberately. Keep the date filter the same while comparing format and projection. Compare counts and computed values.
Include all ongoing work. Account for conversion and temporary copies. A reduction in one query’s scans is not the total cost reduction.
Check the worked example
Choose an option to see the result and explanation.
Check, then explain in your own words
- Fix equivalent output conditions.
- Distinguish selected partitions and columns.
- Assess Athena and S3 cost components separately.
Check your understanding: Does a 95% scan reduction reduce total cost by 95%?
Compare storage, requests, conversions and query frequency in the complete cost model.
95% applies to bytes read in this trial.
Sources and conditions checked
The official references used in this lesson are collected here with their scope, conditions and corresponding sections. Independent expert review and live AWS comparison have not been performed.
- Amazon Athena pricingChecked:
Scope and conditionsScanned-data SQL pricing and separate S3 costs.
Used in this lessonMeasure scans and storage separately Explain the drop from 40 GB to 2 GB Compare measurements under matching conditions
- Optimize data in AthenaChecked:
Scope and conditionsPartition pruning, columnar formats and compression.
Used in this lessonMeasure scans and storage separately Compare measurements under matching conditions