DecidB extends DuckDB with declarative optimization.
Select optimal subsets of data with constraints and objectives — no external tools required.
SELECT item, value, weight, x AS selected
FROM Items
DECIDE x IS BOOLEAN
SUCH THAT
SUM(x * weight) <= 50
MAXIMIZE SUM(x * value);- Native SQL — Express optimization as a SQL extension. No context switching between your database and an external solver.
- Zero Data Movement — Solve directly on database buffers. No export/import overhead.
- Declarative — Define what to optimize, not how. The system handles ILP formulation automatically.
- Built on DuckDB — Columnar storage, vectorized execution, and an embedded HiGHS solver. Optional Gurobi support for commercial workloads.
SELECT select_list
FROM table_expression
[WHERE ...]
DECIDE variable_name [IS type] [, ...]
SUCH THAT constraint [AND constraint ...]
[MAXIMIZE | MINIMIZE] SUM|MIN|MAX(linear_expression)| Feature | Details |
|---|---|
| Variable types | IS BOOLEAN (0/1), IS INTEGER (non-negative, default), IS REAL (continuous) |
| Constraint operators | =, <, <=, >, >=, <>, BETWEEN, IN |
| Aggregates | SUM(), COUNT(), AVG(), MIN(), MAX() |
| Conditional | expression WHEN condition (postfix) |
| Grouping | SUM(expr) op rhs PER column — one constraint per distinct group |
For the full syntax specification, see [context/descriptions/00_project_overview/syntax_reference.md](context/descriptions/00_project_overview/syntax_reference.md).
DecidB requires CMake, Python3, and a C++11 compliant compiler.
make releaseBuild output:
- CLI:
build/release/decidb - Library:
build/release/src/libduckdb.so
make decide-test # Run DECIDE differential tests
make decide-setup # Setup test environment onlyTests are located in [test/decide/](test/decide/).
DecidB can express a wide range of optimization problems directly in SQL:
- Knapsack / Packing — Maximize value within weight or budget limits
- Diet / Nutrition — Meet nutritional targets while minimizing cost
- Portfolio Selection — Maximize return under risk constraints
- Resource Allocation — Assign limited resources to maximize output
- Production Planning — Optimize production quantities with capacity constraints
- Assignment — Assign items to resources optimally
- Scheduling — Complex constraint satisfaction over time slots
- Multi-period Optimization — Time-indexed decision problems with carry-over constraints
Full documentation lives in [context/descriptions/](context/descriptions/). Start with the README there for navigation and reading order.
Key areas:
[00_project_overview/](context/descriptions/00_project_overview/)— Syntax specification[01_pipeline/](context/descriptions/01_pipeline/)— Query processing architecture[03_expressivity/](context/descriptions/03_expressivity/)— Feature status (WHEN, PER, aggregates, etc.)[04_optimizer/](context/descriptions/04_optimizer/)— Optimizer rewrite strategies
DecidB is developed by the HUDA Lab (NYU Abu Dhabi), and UMass Amherst.
Foundation papers:
- Scalable Package Queries in Relational Database Systems (VLDB 2016)
- Scalable Computation of High-Order Optimization Queries (ACM Communications, 2019)
- Scaling Package Queries to a Billion Tuples (VLDB 2024)
Contact: [email protected]
DecidB is released under the MIT License. See LICENSE for details.