All cheat sheets
Databasescheat sheet

Athena Query Result Reuse

Athena caches identical query results in S3, so a repeated dashboard refresh or scheduled report returns instantly with zero bytes scanned. A workgroup checkbox that routinely cuts thousands off a scan-heavy bill.

Last reviewed: July 14, 2026

TL;DR: Query Result Reuse (2019) is Athena being productively lazy: run byte-identical SQL again and it serves the cached result from your S3 results bucket instead of re-scanning. Zero data scanned, tiny S3 GET, instant response. Dashboards, scheduled reports, and monitoring scripts run identical SQL constantly, so the cache hits pile up. It's a workgroup checkbox that costs nothing to enable and quietly cuts the scan bill on every hit.

The numbers

  • A QuickSight dashboard on 5 TB opened by 10 users/day: without reuse 50 TB scanned/day ≈ $7,500/mo; with reuse the first user scans, next 9 hit cache ≈ $750/mo.
  • Default reuse window (TTL) is 60 minutes; tunable per query from 1 minute to 7 days.
  • Field examples: an exec dashboard on 3 TB viewed 50×/day dropped ~$20,000/mo from a checkbox; a Monday 6 AM + 8 AM weekly report on 10 TB went $100→$50/week (the 8 AM run hits cache inside the window).

Do this

  1. Enable reuse at the workgroup level — it's a single setting, zero setup.
  2. Raise the max age for stable data — bump to 24 hours (or up to 7 days) for daily reports and dashboards you know won't change that day; almost every repeat becomes a cache hit.
  3. Standardize SQL formatting — the match is byte-for-byte, so agree on lowercase keywords, consistent whitespace, and templatize common queries in the BI tool so runs are identical. This alone can double the hit rate.
  4. Pin date literalsdate = '2024-11-15' is reusable; date = CURRENT_DATE - INTERVAL '1' DAY changes every run and never hits.
  5. Consolidate overlapping teams into a shared workgroup — reuse is workgroup-scoped, so two teams running the same query in different workgroups pay twice.

Gotchas

  • "Identical" means exact — different whitespace, comments, capitalization, or aliases all break the match; inconsistent team formatting silently kills the hit rate.
  • Table writes invalidate the cache — a new partition or any write drops the cached result (by design, so you never serve stale data).
  • Scoped per workgroup — not per user or client, so the same SQL from QuickSight or another account in the same workgroup still hits; a different workgroup does not.
  • Confirm it's working — watch "Query reused previous results" in the execution history and track average "Data scanned" trending down.

Skip this if

  • Queries must reflect near-real-time state (streaming events, new partitions every few minutes) — Athena detects the table churn and bypasses the cache anyway; it doesn't hurt, it just rarely helps.
  • Your queries rarely repeat byte-for-byte — the lever is SQL standardization first, not the cache.
  • Your bill is about scan volume per query, not repetition — reach for Athena Partition Projection and Parquet/ORC, which cut the cost of the scans you do run.

Run this audit with your AI assistant

Paste this into Claude, ChatGPT, or any agent that can run the AWS CLI with read-only credentials. It audits your account for exactly the waste this sheet describes — and changes nothing.

You are auditing an AWS account's Athena usage for Query Result Reuse
savings. Use the AWS CLI with READ-ONLY credentials. Do not create,
modify, or delete anything — report findings and recommended (unapplied)
fixes only.

1. Workgroups: aws athena list-work-groups + get-work-group — capture
   ResultReuse settings (enabled? max age?) and the results S3 location
   per workgroup. Flag workgroups with reuse OFF.
2. Repetition analysis: aws athena list-query-executions +
   get-query-execution over recent history — hash the normalized query
   text to find identical SQL run repeatedly (dashboards, scheduled
   reports). Sum DataScannedInBytes for the repeats; that × $5/TB is the
   recoverable spend.
3. Cache-killers: look for near-duplicate SQL that differs only in
   whitespace/case/aliases (breaks byte-identical matching) and for
   relative date literals (CURRENT_DATE - INTERVAL) that change each run.
4. Workgroup sprawl: identify teams in SEPARATE workgroups running
   overlapping queries (reuse is workgroup-scoped — they each pay).

Report a table: workgroup | reuse enabled? | est. repeated-query TB/mo |
est. $/mo recoverable | notes (SQL standardization / workgroup
consolidation / freshness needs). Change nothing.
Works with any assistant that can run shell commands.

Want the guided version?

The Athena Query Result Reuse walkthrough covers this topic interactively — it asks about your setup, branches to what’s relevant, and quizzes you on the tricky parts. Free and anonymous.

Start the walkthrough