Reject queries before physical execution when estimated table scans exceed a configured row budget
Maintainer(s):
dentiny
Compatibility Matrix
This table covers all DuckDB releases that have not reached end-of-life, including LTS releases, and shows the 2 most recent patch releases of each. Older patch releases are not listed, but the extension may be available for them as well.
| Platform | 1.4.4 | 1.4.5 | 1.5.5 | 1.5.6 | 2.0.0 |
|---|---|---|---|---|---|
| Linux AMD64 | |||||
| Linux ARM64 | |||||
| macOS AMD64 | |||||
| macOS ARM64 | |||||
| Windows AMD64 | |||||
| Windows ARM64 | |||||
| WebAssembly |
Installing and Loading
INSTALL query_limiter FROM community;
LOAD query_limiter;
Example
SET max_rows_to_scan = 1000000;
CREATE TABLE limiter_demo AS SELECT i FROM range(100) tbl(i);
SELECT sum(i) FROM limiter_demo;
About query_limiter
Query Limiter is a DuckDB extension that rejects queries before physical execution when DuckDB estimates that table scans would exceed a configured row budget.
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| query_limiter_estimate | scalar | Plans one SQL statement without executing it and returns its estimated table-scan rows and unknown scans. | NULL | [SELECT query_limiter_estimate('SELECT * FROM my_table');] |
Overloaded Functions
This extension does not add any function overloads.
Added Types
This extension does not add any types.
Added Settings
| name | description | input_type | scope | aliases | typed_value |
|---|---|---|---|---|---|
| max_rows_to_scan | Reject queries before execution when estimated table-scan rows exceed this value. Defaults to the maximum idx_t value. | UBIGINT | GLOBAL | [] | 18446744073709551615 |
| max_rows_to_scan_unknown | Policy for scans without row estimates when max_rows_to_scan is enabled: allow or reject. | VARCHAR | GLOBAL | [] | allow |
| temp_directory | Set the directory to which temporary files are written. | VARCHAR | GLOBAL | [] | post.db.tmp |