

# Query execution

 DuckDB runs each query either on a single worker or across several workers. Which one it uses depends on the statement, the data that the query reads, and the compute that Athena chooses for the query within its DPU range. Both return the same results. A read-only query that reads Apache Iceberg tables or Hive tables stored as Parquet in the AWS Glue Data Catalog can run across several workers. A query that runs on a single worker currently uses at most 4 DPUs, so a DPU limit above 4 DPUs does not change the compute that it uses. A query that runs across several workers can use more than 4 DPUs. A query can run across several workers only when `max-dpu-count` is 8 DPUs or more, or is not set. Each additional worker adds 4 DPUs. A query can also run on a single worker when Athena chooses a worker smaller than 4 DPUs for it, or when additional workers are not available in time. Queries that run on a single worker include the following: 
+ Statements other than `SELECT` queries, such as `CREATE TABLE AS SELECT`, `INSERT`, `UPDATE`, `DELETE`, `COPY ... TO`, DDL statements, `SHOW`, `DESCRIBE`, `EXPLAIN`, `CALL`, and `SUMMARIZE`.
+ Queries that read or list files by Amazon S3 path, for example with `read_parquet`, `read_csv`, `read_json`, `read_avro`, `iceberg_scan`, `hive_scan`, or `glob`, or with `FROM 's3://...'`, even when the query also reads tables.
+ Queries that read a view, or a Hive table stored as Avro, JSON, CSV, or other delimited text.
+ Queries that read a Hive table stored as Parquet that has a binary column, or an Apache Iceberg table that has a column named `filename` or `file_row_number`.
+ Queries that use Iceberg metadata functions, such as `iceberg_snapshots`, `iceberg_files`, or `iceberg_history`.
+ Queries that use `USING SAMPLE` or `TABLESAMPLE`, `POSITIONAL JOIN`, `ASOF JOIN`, `UNPIVOT`, `UNNEST` of a list or array, `DISTINCT ON`, or a recursive common table expression (CTE) that refers to itself (`WITH RECURSIVE`), or that join tables on a condition other than a comparison between a column of each table, such as an OR of equalities.
+ Queries that use the top-N forms of aggregate functions, such as `max(x, n)`, `min(x, n)`, `arg_max(x, y, n)`, `arg_min(x, y, n)`, `max_by(x, y, n)`, and `min_by(x, y, n)`, or `reservoir_quantile`, on a large input. When the input is small, these queries can still run across several workers.
+ Queries that call `iceberg_truncate`.