Quickstart
This walks through one real session in the linal REPL: a hybrid table with a vector
column, an index-accelerated similarity search, and a classical linear algebra call. Every
statement below was run against a real build of the engine before being written down here.
Each line is one statement: paste them in one at a time in the REPL, or save them to a
.lnl file (one statement per line) and run it with linal run <file>.
linal repl1. A hybrid table
Section titled “1. A hybrid table”Scalar columns and a native Vector column, in one dataset:
DATASET docs COLUMNS (id: Int, title: String, embedding: Vector(3))INSERT INTO docs VALUES (1, "Intro to linear algebra", [0.9, 0.1, 0.0])INSERT INTO docs VALUES (2, "SQL query optimization", [0.1, 0.9, 0.0])INSERT INTO docs VALUES (3, "Vector search at scale", [0.8, 0.2, 0.1])2. Vector math inside SQL
Section titled “2. Vector math inside SQL”COSINE_SIM works directly in SELECT/WHERE/ORDER BY, no separate vector query
language:
SELECT id, title, COSINE_SIM(embedding, [1.0, 0.0, 0.0]) AS scoreFROM docsORDER BY score DESC┌──────────┬───────────────────────────┬───────────────┐│ id (INT) ┆ title (STRING) ┆ score (FLOAT) │╞══════════╪═══════════════════════════╪═══════════════╡│ 1 ┆ "Intro to linear algebra" ┆ 0.9938837 ││ 3 ┆ "Vector search at scale" ┆ 0.9630868 ││ 2 ┆ "SQL query optimization" ┆ 0.11043153 │└──────────┴───────────────────────────┴───────────────┘3. Index-accelerated similarity search
Section titled “3. Index-accelerated similarity search”For top-k retrieval at scale, build a vector index and use SEARCH instead of a full
ORDER BY scan:
CREATE VECTOR INDEX ON docs(embedding)SEARCH docs ON embedding QUERY [1.0, 0.0, 0.0] LIMIT 2 INTO nearestSELECT id, title FROM nearestPast ~64 rows, CREATE VECTOR INDEX automatically clusters the column (IVF-style). This
tiny example is below that threshold, but the syntax is identical at real scale. See
Pipelines & Vector Search for the full picture,
including the WHERE embedding ~= [...] shorthand and why SEARCH requires an index
while ad hoc COSINE_SIM (step 2 above) doesn’t.
4. Classical linear algebra, natively
Section titled “4. Classical linear algebra, natively”No numpy/scipy round-trip:
MATRIX m = [[4, 7], [2, 6]]LET det = DETERMINANT mSHOW detLET inv = INVERSE mSHOW invSHOW prints the full tensor record, including id, creation time, the operation that
produced it, shape, and data:
Tensor ID: bae7e999-...Source Op: DETERMINANTShape: []Data: [10.0]Try SOLVE, QR, LU, EIGEN, or SVD the same way. See Vectors & Linear
Algebra for the full set.
5. Persistence
Section titled “5. Persistence”SAVE DATASET docsLOAD DATASET docsSHOW ALL DATASETSSAVE DATASET writes a real Parquet package (data + schema + stats + lineage) to disk,
including which columns are indexed; LOAD DATASET rebuilds those indexes automatically
on the way back in.
- The full language, organized by task: DSL Reference.
- Why this is fast: Architecture.
- Real problems solved end-to-end: Use Cases.
- Try all of this in your browser, no install: Playground.

