ToriDB provides a high-performance relational engine that combines classic SQL integrity with modern vector storage capabilities.
ToriDB is schema-first for relational tables. You must define a table before inserting data.
| Type | Description | Example |
|---|---|---|
int |
64-bit signed integer | 42 |
string |
UTF-8 UTF-8 string | "Hello" |
float |
64-bit floating point | 3.14 |
bool |
Boolean (true/false) |
true |
datetime |
ISO8601 or Timestamp | "2024-01-01" |
blob |
Binary data (Base64) | "SGVsbG8=" |
vector |
Float array embedding | [0.1, 0.2, ...] |
json |
Native JSON Document | '{"key": "val"}' |
CREATE TABLE users (
id:int:pk,
email:string,
profile:json,
features:vector
):pkmarks a column as Primary Key.:fk(table.col)marks a Foreign Key relationship.
SELECT name, email FROM users WHERE age >= 18 AND status = "active"ToriDB supports real-time aggregation over in-memory sets, including joined tables.
- Selectors:
COUNT(*),SUM(col),AVG(col),MAX(col),MIN(col). - Grouping:
GROUP BY col1, col2. - Filtering:
HAVING count(*) > 5.
Efficient in-memory joins using Hash-Join implementation.
SELECT orders.id, users.email
FROM orders
JOIN users ON orders.user_id = users.idPerform K-Nearest Neighbor (KNN) searches across high-dimensional vectors.
SEARCH <table> <column> <pivot_vector> <limit>
SEARCH products embedding [0.12, 0.45, 0.22] 5- Similarity Metric: Cosine Similarity.
- Normalization: Vectors are auto-normalized for consistent similarity scoring.
- Performance: Calculated parallelly across the worker pool.
Query inside json columns using the Arrow Operator (->).
SELECT email FROM users WHERE profile->settings->theme = "dark"