CortexQL is the structured command language of CortexDB.
It is not SQL.
It does not emulate relational semantics.
It is designed to map directly to the internal primitives of the engine.
CortexQL follows the same hierarchy as CortexDB itself:
KV → JSON (optional) → Vector → Replication → Indexing
Execution Model
CortexQL uses a lightweight pipeline model:
SCAN → WHERE → PROJECT → AGGREGATE → LIMIT
Each operator corresponds directly to storage or index primitives.
There is no global SQL planner.
No JOIN engine.
No relational abstraction layer.
Execution remains predictable and aligned with the LSM-based core.
KV First
The dominant layer remains key–value:
PUT key value
GET key
SCAN PREFIX "user:"Ordered scans are first-class primitives.
Everything else builds on top of this model.
Documents (Optional)
JSON documents are a value convention, not a separate engine.
SCAN PREFIX "user:"
| WHERE JSON("$.age") >= 18
| LIMIT 50Indexing and validation are introduced progressively.
Vector Collections
Vector operations are explicit and isolated:
VCREATE embeddings DIM 768 METRIC cosine
VSEARCH embeddings VECTOR(...) TOPK 10Vector search is CPU-oriented and integrated into the storage model.
Design Principles
CortexQL is defined by:
- Explicit operations
- Pipeline composition
- Progressive evolution
- Alignment with storage invariants
- Bounded complexity
It is not a SQL replacement. It is a language aligned with CortexDB’s architecture.