# Amazon Athena

**Amazon Athena** 是[亚马逊云科技](https://www.edgepedia.org/zh/amazon-web-services)（AWS）推出的一款无服务器交互式查询服务，它使用标准 SQL 直接在 Amazon Simple Storage Service（Amazon S3）中分析数据，无需搭建或管理任何基础设施，也无需数据加载步骤<sup>[1](https://docs.aws.amazon.com/athena/latest/ug/what-is.html)</sup>。用户将 Athena 指向 S3 中的数据，定义模式，即可运行即席查询，结果在数秒内返回<sup>[1](https://docs.aws.amazon.com/athena/latest/ug/what-is.html)</sup>。除 SQL 引擎外，Athena 还可通过控制台中的笔记本体验或 Athena Spark API 以交互方式运行 [Apache Spark](https://www.edgepedia.org/zh/apache-spark) 应用<sup>[1](https://docs.aws.amazon.com/athena/latest/ug/what-is.html)</sup>。

| 关键事实 | 详情 |
|---|---|
| 是什么 | 面向 Amazon S3 中数据的无服务器交互式查询服务，使用标准 SQL<sup>[1](https://docs.aws.amazon.com/athena/latest/ug/what-is.html)</sup> |
| SQL 引擎 | Athena 引擎版本 3 基于 Trino 构建；版本 2 基于 Presto 构建<sup>[2](https://aws.amazon.com/athena/faqs/)</sup> |
| 定价 | 查询按扫描的数据量计费，每扫描 1 太字节收费 5 美元<sup>[3](https://www.techtarget.com/it-infrastructure/definition/Amazon-Athena)</sup> |
| 数据格式 | CSV、JSON、Apache ORC、Apache Parquet 和 Apache Avro<sup>[2](https://aws.amazon.com/athena/faqs/)</sup> |
| 目录与访问 | AWS Glue Data Catalog、外部 Hive 元数据存储，或通过预构建连接器进行联邦查询；可通过控制台、SDK/CLI 或 ODBC 和 JDBC 驱动程序访问<sup>[4](https://docs.aws.amazon.com/athena/latest/ug/using-athena-sql.html)</sup> |
| 引擎版本 3 | 于 2022 年 10 月 13 日发布，包含 50 多个新 SQL 函数、30 项新功能和 90 多项查询性能改进<sup>[5](https://docs.aws.amazon.com/athena/latest/ug/release-notes.html)</sup> |
| 版本控制 | 引擎版本按工作组配置，默认自动升级<sup>[6](https://docs.aws.amazon.com/athena/latest/ug/engine-versions.html)</sup> |

## 工作原理

Athena 就地查询 S3 中的数据，因此文件无需在分析前加载或转换<sup>[1](https://docs.aws.amazon.com/athena/latest/ug/what-is.html)</sup>。表元数据来自 AWS Glue Data Catalog、外部 Hive 元数据存储，或指向其他数据源的联邦查询连接器<sup>[4](https://docs.aws.amazon.com/athena/latest/ug/using-athena-sql.html)</sup>。由于该服务是无服务器的，计算资源自动预置，查询并行运行，AWS 表示即便面对大型数据集和复杂查询，这也能保持结果快速返回<sup>[1](https://docs.aws.amazon.com/athena/latest/ug/what-is.html)</sup>。

访问方式包括 AWS 管理控制台、AWS SDK 和 CLI，或 Athena 的 ODBC 和 JDBC 驱动程序，从而支持以编程方式执行查询以及管理表或分区<sup>[2](https://aws.amazon.com/athena/faqs/)</sup>。除普通 SQL 外，Athena 还可查询 AWS 服务日志、[Apache Iceberg](https://www.edgepedia.org/zh/apache-iceberg) 表（包括时间旅行查询）、[Apache Hudi](https://www.edgepedia.org/zh/apache-hudi) 数据集和地理空间数据，并支持用户定义函数以及通过 Amazon SageMaker AI 进行机器学习推理<sup>[4](https://docs.aws.amazon.com/athena/latest/ug/using-athena-sql.html)</sup>。

## 定价与成本行为

Athena 的定价模式按查询收费，而非为闲置容量付费：查询成本为每扫描 1 太字节数据 5 美元<sup>[3](https://www.techtarget.com/it-infrastructure/definition/Amazon-Athena)</sup>。这使得成本直接取决于数据布局。将数据转换为压缩的列式格式（如 [Apache Parquet](https://www.edgepedia.org/zh/apache-parquet) 或 [Apache ORC](https://www.edgepedia.org/zh/apache-orc)）可降低费用并提升性能，因为这使 Athena 从 S3 扫描的数据更少<sup>[7](https://docs.aws.amazon.com/pdfs/whitepapers/latest/big-data-analytics-options/big-data-analytics-options.pdf)</sup>；分区可以改善查询性能，但并非高效查询的必要条件<sup>[3](https://www.techtarget.com/it-infrastructure/definition/Amazon-Athena)</sup><sup> • </sup><sup>[17](https://aws.amazon.com/athena/faqs/?das=sec&sec=prep)</sup><sup> • </sup><sup>[18](https://docs.aws.amazon.com/us_en/athena/latest/ug/performance-tuning-data-optimization-techniques.html)</sup>。

在一项按标价对 10 TB 工作负载进行的对比成本建模中，Athena 在常开分析场景中位列最便宜的引擎之一（每月 730 美元，为该列最低），在 BI 仪表板（430 美元）和夜间批处理 ELT（330 美元）场景中也接近最低价，而 Redshift Serverless 在相同工作负载下分别为 9,000 美元、1,200 美元和 1,320 美元<sup>[8](https://bigdataexplained.com/compare)</sup>。同一对比指出，这一排名是工作负载的属性，而非厂商的属性<sup>[8](https://bigdataexplained.com/compare)</sup>。

## 引擎版本

SQL 引擎的血统不止一次发生变化。2016 年 11 月 30 日的发布公告称 Athena 使用 Presto，2018 年 1 月 19 日的公告则描述了对基于 Presto 0.172 的引擎进行的一次透明更新，当时用户尚无法选择版本<sup>[9](https://hidekazu-konishi.com/entry/aws_history_and_timeline_amazon_athena.html)</sup>。

**引擎版本 2** 于 2020 年 11 月 11 日在美国东部（弗吉尼亚北部）、美国东部（俄亥俄）和美国西部（俄勒冈）区域正式可用，新增了对 Parquet 数据的模式演化支持、更多地理空间函数、对读取嵌套模式以降低成本的支持，以及 JOIN 和 AGGREGATE 操作的性能增强<sup>[5](https://docs.aws.amazon.com/athena/latest/ug/release-notes.html)</sup>。自此开始，可以按工作组选择版本<sup>[9](https://hidekazu-konishi.com/entry/aws_history_and_timeline_amazon_athena.html)</sup>。

**引擎版本 3** 于 2022 年 10 月 13 日发布，融合了 Trino 开源项目的最新特性，除支持版本 2 的全部功能外，还包含 50 多个新 SQL 函数、30 项新功能和 90 多项查询性能改进<sup>[5](https://docs.aws.amazon.com/athena/latest/ug/release-notes.html)</sup>。伴随此次发布，AWS 引入了持续集成式的开源软件管理方法，提升了与 Trino 和 Presto 项目的同步时效，使社区改进能更快进入 Athena 引擎<sup>[5](https://docs.aws.amazon.com/athena/latest/ug/release-notes.html)</sup>。

引擎版本按工作组配置。默认情况下，工作组设置为自动升级，即除非发现不兼容，否则 Athena 会对其进行升级；如果工作组被固定到某个版本，Athena 不会更改它，但无论哪种情况，当某个版本不再可用时，Athena 都会升级工作组<sup>[6](https://docs.aws.amazon.com/athena/latest/ug/engine-versions.html)</sup>。少量查询可能因不兼容而在新引擎版本上失败，AWS 建议使用测试工作组提前测试查询<sup>[6](https://docs.aws.amazon.com/athena/latest/ug/engine-versions.html)</sup>。

## 与其他方案的比较

**Redshift Spectrum** 是 AWS 体系内最接近的同类产品。两者都用 SQL 查询 S3 数据而无需移动数据，且都能读取相同的数据目录，因此从其中一个入手并不会排斥另一个<sup>[10](https://builder.aws.com/content/3H7Vgwift5DYLAMwjGXy1WrInMe/athena-vs-redshift-spectrum-querying-your-data-lake)</sup>。然而，Spectrum 需要已有的 Redshift 数仓，且其设计目标是在单个查询中将数仓数据与 S3 数据连接，而 Athena 可独立运行、配置极少，闲置时不产生费用<sup>[10](https://builder.aws.com/content/3H7Vgwift5DYLAMwjGXy1WrInMe/athena-vs-redshift-spectrum-querying-your-data-lake)</sup>。Athena 的性能取决于查询设计、数据集组织、文件格式与压缩，以及可用的查询处理能力，而不仅仅是 S3 优化；Spectrum 的性能则取决于 Redshift 集群资源；Spectrum 适合大型复杂查询，Athena 适合交互式查询<sup>[11](https://www.integrate.io/blog/amazon-redshift-spectrum-vs-athena/)</sup><sup> • </sup><sup>[18](https://docs.aws.amazon.com/us_en/athena/latest/ug/performance-tuning-data-optimization-techniques.html)</sup>。

与 **Google BigQuery** 相比，Athena 的优势在于：用标准 SQL 查询 S3 而无需管理基础设施；跨关系型、非关系型和自定义数据源进行联邦查询；以及 Glue Catalog、JDBC/ODBC、Spark 和工作组成本控制；其计费按扫描数据量而非固定用户套餐，而高级治理则依赖 Lake Formation 等 AWS 服务<sup>[12](https://www.itechguides.com/compare/google-bigquery-vs-amazon-athena/)</sup>。

系统设计对比给出的实用总结是：Athena 在运维简便性上胜出，在极端规模下成本上处于劣势，在性能上不及经过调优的自托管 Trino 集群；它适合数据已存放在 S3 中、且需要在数据湖上运行即席 SQL 的团队<sup>[13](https://www.naildd.com/blog/aws-athena-data-engineering-interview)</sup>。

## 性能特征

在一项获 VLDB 认可的关于云 DBMS 选择的 TPC-H 研究中，在 22 条查询中能在全部被测系统上运行的 16 条查询里，Athena 和 Redshift 表现最佳，但 Redshift Spectrum 不在其中<sup>[14](https://blog.acolyer.org/2019/08/30/choosing-a-cloud-dbms/)</sup>。同一研究指出，像 Athena 这样的无服务器产品提供“即时启动”的查询服务，避免了使用本地存储的系统（如 Redshift）所需的初始化时间<sup>[14](https://blog.acolyer.org/2019/08/30/choosing-a-cloud-dbms/)</sup>。

实践中的性能在很大程度上取决于 S3 中的数据组织。AWS 指南建议采用列式文件格式、排序记录和分区以减少扫描数据，并指出分区投影可加速高度分区表的处理并实现分区管理自动化<sup>[15](https://docs.aws.amazon.com/athena/latest/ug/performance-tuning-data-optimization-techniques.html)</sup><sup> • </sup><sup>[4](https://docs.aws.amazon.com/athena/latest/ug/using-athena-sql.html)</sup>。

## 近期发展

2026 年 2 月，Athena 新增对 1 分钟容量预留和 4 个数据处理单元（DPU）最小容量的支持，为需要查询优先级和并发控制的交互式 SQL 工作负载提供专用的无服务器计算资源<sup>[16](https://docs.aws.amazon.com/us_en/athena/latest/ug/release-notes.html)</sup>。2026 年 3 月，Athena 新增对 [Amazon S3](https://www.edgepedia.org/zh/amazon-s3) Tables 和 Apache Iceberg 物化视图的基于 AWS IAM 的授权，允许在单个 IAM 策略中定义跨存储、目录和查询引擎的权限<sup>[16](https://docs.aws.amazon.com/us_en/athena/latest/ug/release-notes.html)</sup>。Athena SQL 于 2026 年 1 月在亚太地区（新西兰）区域可用<sup>[16](https://docs.aws.amazon.com/us_en/athena/latest/ug/release-notes.html)</sup>。

## References

1. [What is Amazon Athena? - Amazon Athena User Guide](https://docs.aws.amazon.com/athena/latest/ug/what-is.html)
2. [Amazon Athena FAQs - AWS](https://aws.amazon.com/athena/faqs/)
3. [What is Amazon Athena? - TechTarget](https://www.techtarget.com/it-infrastructure/definition/Amazon-Athena)
4. [Use Athena SQL - Amazon Athena User Guide](https://docs.aws.amazon.com/athena/latest/ug/using-athena-sql.html)
5. [Release notes - Amazon Athena](https://docs.aws.amazon.com/athena/latest/ug/release-notes.html)
6. [Athena engine versioning - Amazon Athena User Guide](https://docs.aws.amazon.com/athena/latest/ug/engine-versions.html)
7. [Big Data Analytics Options on AWS - AWS Whitepaper](https://docs.aws.amazon.com/pdfs/whitepapers/latest/big-data-analytics-options/big-data-analytics-options.pdf)
8. [Warehouse cost comparisons - Big Data Explained](https://bigdataexplained.com/compare)
9. [AWS History and Timeline regarding Amazon Athena - hidekazu-konishi.com](https://hidekazu-konishi.com/entry/aws_history_and_timeline_amazon_athena.html)
10. [Athena vs. Redshift Spectrum: Querying Your Data Lake - AWS Builder Center](https://builder.aws.com/content/3H7Vgwift5DYLAMwjGXy1WrInMe/athena-vs-redshift-spectrum-querying-your-data-lake)
11. [Amazon Redshift Spectrum vs. Athena: A Detailed Comparison - Integrate.io](https://www.integrate.io/blog/amazon-redshift-spectrum-vs-athena/)
12. [Google BigQuery vs Amazon Athena (2026) - iTechGuides](https://www.itechguides.com/compare/google-bigquery-vs-amazon-athena/)
13. [AWS Athena Data Engineering Interview - Serverless SQL on S3 - NAILDD](https://www.naildd.com/blog/aws-athena-data-engineering-interview)
14. [Choosing a cloud DBMS: architectures and tradeoffs - the morning paper](https://blog.acolyer.org/2019/08/30/choosing-a-cloud-dbms/)
15. [Optimize data - Amazon Athena User Guide](https://docs.aws.amazon.com/athena/latest/ug/performance-tuning-data-optimization-techniques.html)
16. [Release notes (2026) - Amazon Athena](https://docs.aws.amazon.com/us_en/athena/latest/ug/release-notes.html)
17. [Amazon Athena FAQs](https://aws.amazon.com/athena/faqs/?das=sec&sec=prep)
18. [Optimize data - Amazon Athena](https://docs.aws.amazon.com/us_en/athena/latest/ug/performance-tuning-data-optimization-techniques.html)

---
*Initially written Oct 26, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Databases and data systems › SQL and query languages › Query tools and interfaces

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/amazon-athena

English original: https://www.edgepedia.org/amazon-athena
