Posted On: Nov 8, 2022

You can now accelerate repeat queries in Amazon Athena with Query Result Reuse, a new caching feature released today. Repeat queries are SQL queries submitted within a short period of time and produce the same results as one or more previously run queries. In use cases like business intelligence, where interactive analysis in a dashboard can cause multiple identical queries to be run, repeat queries can increase time to insight as each query needs time to read and process data before returning results to the user.

Query Result Reuse works by returning a previously stored query result when a repeat query is submitted. Athena identifies repeat queries automatically for you, so you don’t need to change your existing queries or modify any application code. With Query Result Reuse, repeat queries run up to 5x faster, giving you increased productivity for interactive data analysis; and don’t scan data, so you get improved performance at lower cost.

Using Query Result Reuse is simple and intuitive. From the Athena console, turn on Query Result Reuse using the *Reuse query results* toggle in the query editor. By default, results from previous queries can be reused by new queries for 60 minutes, but you can choose an expiration time that works best for your use case and frequency of updates in your data lake. Query Result Reuse is available through the Athena console, API, AWS SDK, and compatible applications connecting through Athena’s JDBC or ODBC drivers. Query Result Reuse requires Athena engine version 3, which is more performant and offers additional features not available in version 2.

To learn how to accelerate your queries, see Working with Query Result Reuse.