PARAS MADAN
All writing

Latest in AI

Amazon Athena on DuckDB: What to Test Before Moving Your Queries

Compare the DuckDB preview with Athena engine 3 on identical S3 data, check result parity, and measure cost per workload instead of trusting headline savings.

AWS announced Amazon Athena powered by DuckDB on December 1. It's a preview for querying data in S3. If you already run Athena engine version 3, don't start by swapping production queries. Start with one result you can prove is right on both engines.

This matters even more when an AI analyst writes the SQL. A query can run on both engines and still produce different totals because a date, a cast or an empty value was handled differently.

Keep the preview separate from the existing engine

DuckDB's announcement describes the managed Athena preview and DuckDB Scales, an extension initially available in Athena that can distribute a query across machines. The DuckDB team plans an open-source release of Scales in the first half of 2027. That's distinct from running ordinary DuckDB on your laptop. AWS also described future work in EMR and Redshift, not current availability there.

If you have preview access, identify the endpoint and configuration your account was given. Keep the existing Athena workflow in place and run the comparison against an approved read-only snapshot in S3. Don't change the engine underneath a scheduled reporting job to get a benchmark.

Test the queries that change a decision

Pick a workload you know: weekly order totals, refunds by region and a year-to-date cohort report. Freeze the input partitions and write down the expected result for one small slice before you run the whole thing. Then compare column types, row counts, totals and any null or empty cases. Sort results by a stable key before comparing outputs so different default row ordering isn't mistaken for a data error.

Put date bucketing, timezones, decimal sums, JSON extraction and unsupported functions on the list. For example, reconcile the refunds near local midnight by ID, not only the daily sum. If you need to change SQL for the DuckDB version, record the rewrite explicitly. Compatibility matters more than whether both systems accepted the original query text.

Split fast lookups from heavy scans

AWS says its preview ran up to twice as fast as engine version 3 and cut costs by up to 50% on queries of 100 GB or more. Those are vendor figures, not an estimate for a handful of small queries. Separate a quick filtered report from a large join and an analyst session that issues repeated queries.

Run each group more than once on equivalent data and record elapsed time and the usage metrics available to your preview. Label cache effects and retries rather than averaging them away. A cheaper large join won't help a product that mainly runs small lookups, and faster scans won't pay for mistakes in the results.

Try the analyst workflow after the SQL check

Once a small set of known queries agrees, let the agent draft SQL against the preview schema in an approved test environment. Keep the business definition and expected answers unchanged. Check which engine it thinks it's writing for and how often it has to retry. Compare the whole chain's cost, including incorrect, failed and repeated queries, not only the cleanest SQL run.

I would keep the first switch reversible: move one read-only report after it matches results, then broaden only when the performance case holds across more than one type of workload.

I'm Paras. I can help you design that comparison before changing what powers your reports or AI analyst. Book a 30-minute call.