What to do with Athena Results Files?

Viewed 1237

Newer to AWS and working with Athena for the first time. Would appreciate any help/clarification.

I set the query results location to be s3://aws-athena-query-results-{ACCOUNTID}-{Region}, I can see that whenever I am running the query, whether it be from console or externally elsewhere, that the two results file are created as expected.

However, my question is what are supposed to do with these files long term? What are some recommendations on rotating them? From what I understand, these are the query results (other one is metadata file) that contains the results of the user's query and is passed back to them. What are the recommendations on how to manage the query results bucket files? I don't want to just let them accumulate there and comeback to a million files if that makes sense.

I did search through the docs and couldn't find info on the above topic, maybe I missed it? Would appreciate any help!

Thanks!

1 Answers

From the documentation,

You can delete metadata files (*.csv.metadata) without causing errors, but important information about the query is lost

The query results files can be safely deleted if you dont want to refer back to the query that ran at a particular date in past and the result it returned. If you have deleted the results files from the S3 buckets and from Athena "History" trying to download the result, it will just give you error message that result file is not available.

In summary, its up to your use case whether you can afford to run the same query in future if required? or just want to extract the result from past run history.

Related