# Adaptive Query Execution

Glossary, read 10 Nov 2026

**The short answer.** Adaptive Query Execution (AQE) lets Spark SQL re-optimize a running query from runtime statistics. The Spark documentation says it has been enabled by default since Apache Spark 3.2.0, controlled by spark.sql.adaptive.enabled. It coalesces small shuffle partitions, splits skewed ones and can switch a sort-merge join to a broadcast join.

AQE waits until a shuffle stage finishes, reads the real partition sizes, and then rewrites the rest of the plan. That is why a plan shown by EXPLAIN before the run can differ from the one the Spark UI shows afterward.

Native engines that plug into Spark inherit this behavior only for the parts of the plan they leave to Spark. When you compare options, check whether the benchmark baseline ran with AQE on. See also [skew](/glossary/skew/) and [broadcast hash join](/glossary/broadcast-hash-join/).

## A sourced example

The Spark configuration page lists spark.sql.adaptive.localShuffleReader.enabled (default true): after AQE turns a sort-merge join into a broadcast-hash join, Spark reads the shuffle files locally instead of over the network.

## Sources

- Apache Spark documentation: SQL performance tuning, Adaptive Query Execution: https://spark.apache.org/docs/latest/sql-performance-tuning.html (read 10 Nov 2026)

Last reviewed 10 Nov 2026. Canonical: https://sparkaccelerationcompare.com/glossary/adaptive-query-execution/
