Configure the extension
Extension settings become available after you load the extension. To change a setting before you run ATTACH, first run LOAD athena FROM aws.amazon.com;.
Use SET to change a setting for the session, and RESET to restore its default. A setting that is read at ATTACH applies to catalogs that you attach afterward.
SETsetting=value; RESETsetting;
Requests and query execution
The following table lists settings for requests and query execution.
| Setting | Default | Behavior |
|---|---|---|
athena_endpoint | Region public endpoint | Athena endpoint override; read at ATTACH. |
athena_glue_endpoint | Region public endpoint | Glue endpoint for listing table buckets with S3Tables '*'. |
athena_workgroup | primary | Workgroup when the ATTACH path does not name one. |
athena_engine_version | Not set | Engine named on submissions when ATTACH did not pin an engine; leave unset for the workgroup-based setup. |
athena_poll_ms | 200 | Maximum polling wait, in milliseconds, during the first five seconds. 0 uses the default of 200; values above 60000 are treated as 60000. Later waits grow to the larger of this effective value and 2,000 milliseconds. |
athena_timeout_seconds | 900 | Seconds an execution can remain unfinished before the extension sends a stop request. 0 uses the default of 900; values above 31536000 are treated as 31536000. If the execution completed before the stop took effect, the statement preserves its final state. |
athena_log_http | false | Log Athena and Glue requests to the DuckDB HTTP log; excludes result stream reads. |
Metadata
The following table lists metadata settings.
| Setting | Default | Behavior |
|---|---|---|
athena_lazy_schema_listing | true | Defer database listing until needed; read at ATTACH. Catalogs with S3Tables list at ATTACH. |
athena_single_table_lookup | true | Look up a named table individually until the database is listed; read at ATTACH. |
athena_metadata_cache_scope | transaction | Refresh metadata each transaction, or set connection to retain it until rollback, a write or DDL submitted through the attached catalog or athena_execute, or CALL athena_clear_cache(). Writes through athena_query do not clear this cache. Changes apply from the next transaction. |
athena_metadata_concurrency | 2 | Concurrent database reads for catalog-wide listing until throttled; 1 reads sequentially. |
Metadata calls share the account Athena throttling rate across clients.
With athena_metadata_cache_scope = 'connection', cached metadata can remain stale after other clients change tables or databases. Call athena_clear_cache() to refresh the next lookup in the attached catalogs. Use the following commands to refresh cached table listings after another client changes the database.
SET athena_metadata_cache_scope = 'connection'; SELECT table_name FROM information_schema.tables WHERE table_catalog = 'ath' AND table_schema = 'my_database'; CALL athena_clear_cache(); SELECT table_name FROM information_schema.tables WHERE table_catalog = 'ath' AND table_schema = 'my_database'; RESET athena_metadata_cache_scope;
Result retrieval
The following table lists result retrieval settings.
| Setting | Default | Behavior |
|---|---|---|
athena_fetch_size | 0 (10,000 rows) | Target rows per ranged S3 comma-separated values (CSV) read; maximum 1,000,000. |
athena_decode_threads | 4 | Threads that decode Arrow result batches in parallel. 1 decodes on the query thread; the maximum is 64. |
athena_stream_buffer_bytes | 8388608 | Per-stream decode buffer budget, with a minimum of 65536 bytes. It accounts for framed data awaiting decoding and decoded batches awaiting delivery. A whole message can exceed the budget. It does not cap the separate HTTP queue or total process memory. |
athena_schema_cache_entries | 100 | Statement shapes whose result schemas the connection retains. |
athena_max_fragment_bytes | 68719476736 | Maximum bytes per streamed result; 0 removes the cap. |
athena_stream_stall_seconds | 300 | Seconds without source progress during an active wait for data or for the response to end before the stream is abandoned; time blocked by backpressure is excluded. 0 removes the guard. |
Query pushdown
The following table lists pushdown settings.
| Setting | Default | Behavior |
|---|---|---|
athena_enable_remote_pushdown | true | Push eligible statements to Athena; read at ATTACH. When false, reads run locally over per-table reads. Writes and data definition language (DDL) statements still run on Athena unless they contain a query, other than a view body, that is neither a VALUES list nor a SELECT without FROM. |
athena_enable_filter_pushdown | true | Include eligible local plan filters in per-table reads; other filters are applied locally. |
Inspect per-table reads
Set athena_enable_remote_pushdown before attaching the catalog to keep its queries local over per-table reads. Then set athena_enable_filter_pushdown to false to inspect a read without the local plan filter in the SQL sent to Athena. The following example logs a read of a table with product and units columns.
SET athena_enable_remote_pushdown = false; ATTACH 'athena://us-west-2/my-duckdb-workgroup' AS local_reads (TYPE athena, Catalog 's3tablescatalog/amzn-s3-demo-table-bucket', Database 'retail', Secret 'athena_creds'); RESET athena_enable_remote_pushdown; SET athena_enable_filter_pushdown = false; CALL enable_logging('athena', storage := 'memory'); SELECT product FROM local_reads.retail.widget_salesWHERE units > 50 ORDER BY product; SELECT message FROM duckdb_logs WHERE message LIKE '%table scan streamed%' OR message LIKE '%table scan as csv%'; RESET athena_enable_filter_pushdown; DETACH local_reads; CALL disable_logging();