AWS Builder Center

Your AWS Analytics Team Is Running Queries. But Who Is Tracking the Cost?

Amazon Athena introduced managed system tables on November 9, 2026. They automatically capture query executions, scanned data, users, performance, and errors in queryable Apache Iceberg tables. Build cost dashboards, investigate slow queries, and audit workloads using SQL instead of maintaining a custom monitoring pipeline.

01. The problem nobody notices until the bill arrives
Imagine your company runs an analytics platform on Amazon Athena.
Different teams execute hundreds of SQL queries every day.
The data platform team starts receiving questions:
  • Which team is scanning the most data?
  • Why did yesterday's queries become slower?
  • Who accessed the customer_orders table?
  • Which queries are consuming the most resources?
  • How many production queries are failing?
You already have CloudWatch metrics, CloudTrail logs, and Athena APIs.
But getting all the information together means building another pipeline.
You're building analytics infrastructure just to analyze your analytics infrastructure.
That's the problem AWS is addressing.

02. Meet Athena System Tables

On November 9, 2026, AWS announced system tables for Amazon Athena.
The first available table is:
 query_executions 
It automatically records completed Athena queries across your workgroups.
Instead of manually collecting query history, you can directly run SQL against the system table.

The architecture before


Multiple sources. Multiple integrations. Custom maintenance.

The architecture now


One managed data source. Multiple analytical use cases.

03. What exactly gets recorded?

The  query_executions  table contains information about completed query executions.
Think of it as an activity log that you can analyze using SQL.
QUERY EXECUTION
|
+-------------+-------------+
| | |
v v v
IDENTITY PERFORMANCE RESOURCE
| | |
v v v
User ARN Execution Time Data Scanned
Workgroup Queue Time DPU Count
Database Planning Time Tables
| | |
+-------------+-------------+
|
v
QUERY RESULT
|
+-------------+-------------+
| | |
v v v
SUCCEEDED FAILED CANCELLED
Category
Information
Query identity
Query execution ID and SQL statement
User context
Principal ARN and workgroup
Data context
Catalog, database, tables accessed
Performance
Execution, planning, and queue time
Consumption
Bytes scanned and DPU count
Outcome
Success, failure, cancellation, error details
The data becomes available in batches, typically within minutes of query completion.
This is not a real-time query interception system. It is a managed historical record of completed activity.

04. The interesting part: Everything becomes SQL

Let's say your organization has three Athena workgroups.
COMPANY DATA PLATFORM
|
+-----------+-----------+
| | |
v v v
FINANCE ENGINEERING ANALYTICS
WORKGROUP WORKGROUP WORKGROUP
| | |
+-----------+-----------+
|
v
QUERY_EXECUTIONS
|
v
SQL ANALYSIS
You can now investigate all three through the same system table.
The fully qualified table name is:
"s3tablescatalog/aws-athena"."metadata"."query_executions"
Let's build some useful queries.

05. Visual dashboard: Where is the data going?

First, find the amount of data scanned by each workgroup over the last 30 days.
SELECT
work_group_name,
ROUND(
SUM(data_scanned_size) / POWER(1024.0, 4),
3
) AS total_tb_scanned,
COUNT(*) AS query_count
FROM "s3tablescatalog/aws-athena"."metadata"."query_executions"
WHERE submission_date_time >= CURRENT_DATE - INTERVAL '30' DAY
AND state_enum = 'SUCCEEDED'
GROUP BY work_group_name
ORDER BY total_tb_scanned DESC;
Example output:
Workgroup
Data scanned
Queries
analytics
12.8 TB
8,420
finance
4.2 TB
2,100
engineering
1.7 TB
3,850
Illustrative data, not actual AWS measurements.
Now imagine putting that result into a dashboard.
┌──────────────────────────────────────────┐
│ ATHENA COST OVERVIEW │
├──────────────────────────────────────────┤
│ │
│ TOTAL SCANNED │
│ 18.7 TB │
│ │
├──────────────────────────────────────────┤
│ DATA SCANNED BY WORKGROUP │
│ │
│ Analytics █████████████ 12.8 TB │
│ Finance ████ 4.2 TB │
│ Engineering ██ 1.7 TB │
│ │
├──────────────────────────────────────────┤
│ QUERIES │
│ 14,370 │
└──────────────────────────────────────────┘
You can immediately identify which workgroup contributes the largest share of scanned data.

06. Find your most expensive queries

A few poorly written queries can scan enormous amounts of data.
Let's identify the top 10 queries by data scanned.
SELECT
query_execution_id,
work_group_name,
principal_arn,
ROUND(
data_scanned_size / POWER(1024.0, 3),
2
) AS scanned_gb,
ROUND(
total_execution_duration / 1000.0,
2
) AS execution_seconds,
SUBSTR(query_string, 1, 200) AS query_preview
FROM "s3tablescatalog/aws-athena"."metadata"."query_executions"
WHERE submission_date_time >= CURRENT_DATE - INTERVAL '7' DAY
AND state_enum = 'SUCCEEDED'
ORDER BY data_scanned_size DESC
LIMIT 10;

What this helps you discover


You can investigate whether queries need:
  • Better partition filtering.
  • Smaller data scans.
  • More selective predicates.
  • Improved file formats.
  • Better data organization.
The point isn't to optimize every large query.
It's to find the queries that deserve attention.

07. Detect performance regressions

Imagine a query normally takes 8 seconds.
After a change to the underlying dataset, it starts taking 35 seconds.
Nobody notices until users complain.
System tables let you compare execution time across different periods.
SELECT
work_group_name,
DATE_TRUNC('day', submission_date_time) AS query_day,
COUNT(*) AS total_queries,
ROUND(
AVG(total_execution_duration) / 1000.0,
2
) AS avg_execution_seconds,
ROUND(
APPROX_PERCENTILE(
total_execution_duration,
0.95
) / 1000.0,
2
) AS p95_execution_seconds
FROM "s3tablescatalog/aws-athena"."metadata"."query_executions"
WHERE submission_date_time >= CURRENT_DATE - INTERVAL '7' DAY
AND state_enum = 'SUCCEEDED'
GROUP BY
work_group_name,
DATE_TRUNC('day', submission_date_time)
ORDER BY query_day;
This gives you a daily performance trend.

Example visualization

AVERAGE QUERY EXECUTION TIME

Day 1 ███ 8 sec
Day 2 ███ 9 sec
Day 3 ████ 11 sec
Day 4 █████ 15 sec
Day 5 ███████████ 35 sec
Day 6 ████████████ 38 sec
Day 7 █████████████ 41 sec

↑
PERFORMANCE
REGRESSION
Illustrative values.
A rising average is a useful warning, but it doesn't prove that every query has slowed down.
That's why the p95 metric is valuable too. It helps expose slow-tail behavior hidden by averages.

08. Who accessed a particular table?

Now let's look at the security and audit side.
Suppose your company wants to know who queried its  customer_orders  table over the last 30 days.
You can use the  tables_accessed  field.
SELECT
query_execution_id,
work_group_name,
principal_arn,
submission_date_time,
state_enum,
ROUND(
data_scanned_size / POWER(1024.0, 2),
2
) AS scanned_mb
FROM "s3tablescatalog/aws-athena"."metadata"."query_executions"
CROSS JOIN UNNEST(tables_accessed) AS t(tbl)
WHERE tbl.database_name = 'sales'
AND tbl.table_name = 'customer_orders'
AND submission_date_time >= CURRENT_DATE - INTERVAL '30' DAY
ORDER BY submission_date_time DESC;

The investigation workflow


This is useful for internal investigations, governance, and understanding how data is being accessed.
For identity and API-level audit requirements, continue using CloudTrail alongside the system tables.

09. What happens when queries fail?

A production analytics platform doesn't just need to know what succeeds.
It needs to understand failures too.
Let's calculate the failure rate by workgroup.
SELECT
work_group_name,
COUNT(*) AS total_queries,
COUNT_IF(state_enum = 'FAILED') AS failed_queries,
ROUND(
COUNT_IF(state_enum = 'FAILED') * 100.0
/ COUNT(*),
2
) AS failure_percentage
FROM "s3tablescatalog/aws-athena"."metadata"."query_executions"
WHERE submission_date_time >= CURRENT_DATE - INTERVAL '7' DAY
GROUP BY work_group_name
ORDER BY failure_percentage DESC;
Example:
Workgroup
Total queries
Failed
Failure rate
analytics
8,420
110
1.31%
finance
2,100
8
0.38%
engineering
3,850
205
5.32%
Illustrative data.
This immediately highlights the engineering workgroup for further investigation.
You can then inspect the error messages to distinguish syntax mistakes from infrastructure or resource-related failures.

10. How is the data stored?

This is where the feature gets interesting from a data-engineering perspective.
Athena stores its system tables as managed Apache Iceberg tables on Amazon S3 Tables.

AWS manages:
  • Table creation.
  • Schema definition and evolution.
  • Data writing.
  • Partitioning.
  • Compaction.
  • Snapshot maintenance.
You own the data in your AWS account.
The system tables are read-only: you cannot insert, update, or delete individual records.
This is important because the history should remain a trustworthy record of completed query activity.

11. Enable Athena System Tables

You can enable the feature from the Athena console or through the AWS CLI.

Visual setup

AWS MANAGEMENT CONSOLE
|
v
AMAZON ATHENA
|
v
ADMINISTRATION
|
v
SYSTEM TABLES
|
v
CONFIGURE
|
v
ENABLE SYSTEM TABLES
|
v
SAVE
Or use the CLI:
aws athena create-system-table-configuration \
--table-name ALL
To verify the configuration:
aws athena get-system-table-configuration \
--table-name ALL
To check the system table status:
aws athena list-system-table-statuses

One important prerequisite

The S3 Tables bucket must be integrated with AWS Glue Data Catalog before you can query the system table.
This is a one-time setup per account and Region.
If you have already integrated S3 Tables with Glue, you don't need to repeat it.

12. Cost and retention

The system table data delivery itself is free.
But that doesn't mean all usage is free.
Component
Cost
System table data delivery
No additional delivery charge
S3 Tables storage
Standard storage and maintenance charges
Athena queries
Normal Athena query charges
Other query engines
Their respective service charges
There's another detail worth remembering.
AWS does not set a default retention period.
You must configure record expiration through S3 Tables to control how long the query history is retained.
QUERY HISTORY
|
v
S3 TABLES
|
+-----+------+
| |
v v
RETAIN EXPIRE
| |
v v
AUDIT HISTORY STORAGE CONTROL
For compliance-sensitive workloads, define retention and access policies before enabling the feature across production accounts.

13. The AI angle: Ask questions instead of writing SQL

This feature also creates an interesting opportunity for AI-assisted analytics.
Imagine asking:
Which workgroup scanned the most data last month, and which queries should we optimize first?
An AI agent can:
  1. Understand the question.
  1. Generate SQL using the system table schema.
  1. Execute the query with read-only permissions.
  1. Analyze the results.
  1. Explain the findings.

AWS also provides an Agent Skill for Athena system tables through the AWS Agent Toolkit.
It includes schemas and vetted query examples that help agents produce more accurate and cost-efficient SQL.
The important safety rule: give the agent read-only access to the system tables and the minimum permissions needed to execute queries.
Do not give a reporting assistant unnecessary write permissions.

14. What should a platform engineer build with this?

Here's a practical roadmap.
ATHENA SYSTEM TABLES
|
+--------------+--------------+
| | |
v v v
COST VIEW PERFORMANCE AUDIT
| | |
v v v
Workgroup Slow Query User
Breakdown Detection Activity
| | |
+--------------+--------------+
|
v
CENTRAL DASHBOARD
|
v
TEAM REPORTING
Start with three dashboards:
Dashboard 1: Cost visibility
  • Data scanned by workgroup.
  • Top 10 queries by scanned data.
  • Usage by user.
Dashboard 2: Performance
  • Average execution time.
  • p95 execution time.
  • Queue time trends.
  • Failed queries.
Dashboard 3: Governance
  • Queries by user.
  • Tables accessed.
  • Failed and cancelled executions.
  • Historical activity.
Don't build everything on day one.
Start with cost visibility. It usually gives platform teams the quickest actionable insight.

The bigger engineering lesson

Observability is not just collecting metrics.
It's making operational data easy to investigate.
Athena already executes the queries. CloudWatch already tracks metrics. CloudTrail already records API activity.
But engineers still needed to build custom pipelines to understand their analytics workloads at scale.
With system tables, Athena turns its own usage history into a managed, queryable dataset.
The interesting part isn't that AWS added another table. It's that you can now use SQL to understand the cost, performance, and behavior of the SQL workloads running across your organization.



Further Reading

Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article