Course contentsShow
← Cloud and Infrastructure
Lesson 2660 of 2,98957. Serverless Data ProcessingFree lesson

Querying Data Formats in Athena

Querying JSON, CSV, Parquet, ORC, and Avro formats in Athena with appropriate SerDes and performance considerations.

Querying Data Formats in Athena

You'll learn how Athena handles different file formats and how choosing the right SerDe impacts query performance and cost.

Understanding Format Support

Athena can query data stored in multiple formats—JSON, CSV, Parquet, ORC, and Avro—directly from S3 without loading it anywhere. Each format requires a SerDe (Serializer/Deserializer) that tells Athena how to interpret the raw bytes. Think of SerDes as translators: they convert file formats into rows and columns Athena can understand.

When you create a table in Athena (via DDL), you specify which SerDe to use:

CREATE EXTERNAL TABLE logs_json (
  timestamp STRING,
  level STRING,
  message STRING
)
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
LOCATION 's3://my-bucket/logs/';

Performance Considerations by Format

Text formats (CSV, JSON): Human-readable, easy to generate, but slow to query. Athena must scan entire files and parse every line. They're uncompressed by default, meaning higher S3 costs and more data scanned per query.

Columnar formats (Parquet, ORC): Store data by column rather than row. Athena can skip irrelevant columns entirely, scanning only what your query needs. These formats also compress better, dramatically reducing data scanned—and since Athena charges per byte scanned, this saves money. Parquet is generally preferred on AWS due to excellent ecosystem support.

Avro: Row-based but includes embedded schemas, useful when schema evolves frequently. Moderate performance between text and columnar formats.

For production analytics workloads, converting CSV/JSON to Parquet can reduce scan costs by 80-90% and improve query speed significantly.

Key Takeaway: Athena supports JSON, CSV, Parquet, ORC, and Avro via SerDes; columnar formats like Parquet drastically reduce scan volume and cost, making them ideal for repeated analytical queries over large datasets.