Posted On: Nov 17, 2023

Starting today, Amazon Athena uses cost-based optimizer (CBO) to enhance query performance based on table and column statistics, collected by AWS Glue Data Catalog. With CBO, Athena analyzes and selects query plan optimizations, such as reordering joins or moving aggregations to earlier in the plan, that improve performance without requiring changes in your SQL code.

CBO is beneficial when your data grows or changes over time. For example, a retail business with hundreds of stores today likely produces more data than it did when there was one store location. Such growth can cause queries to require more complex SQL logic or more processing time than before. Through CBO, Athena applies data-driven query plan optimizations that can overcome changes in data structure and lead to faster performance. Get started by using the Athena or Glue consoles or AWS SDK to generate table statistics for a chosen Glue table. For help generating table statistics, see generating column statistics.

CBO is available in the US East (N. Virginia), US East (Ohio), US West (Oregon), Europe (Ireland), Asia Pacific (Tokyo), and Asia Pacific (Osaka) Regions. For pricing information, visit the AWS Glue pricing page. To learn more, see Using cost-based optimizer in the Athena user guide or read our blog post.