Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

relational_engine Benchmarks

The relational engine provides SQL-like operations on top of tensor_store, with optional hash indexes for accelerated equality lookups and tensor-native condition evaluation.

Row Insertion

CountTimeThroughput
100462us216K rows/s
1,0003.1ms319K rows/s
5,00015.6ms320K rows/s

Batch Insertion

CountTimeThroughput
100282us355K rows/s
1,0001.45ms688K rows/s
5,0007.26ms688K rows/s

Select Full Scan

RowsTimeThroughput
100119us841K rows/s
1,000995us1.01M rows/s
5,0005.27ms949K rows/s

Select with Index vs Without (5,000 rows)

Query TypeWith IndexWithout IndexSpeedup
Equality (2% match)105us4.23ms40x
By _id (single row)2.93us4.70ms1,604x

Select Filtered - No Index (5,000 rows)

Filter TypeTime
Range (20% match)4.16ms
Compound AND4.42ms

Index Creation (parallel)

RowsTime
100554us
1,0002.75ms
5,00012.3ms

Update/Delete (1,000 rows, 10% affected)

OperationTime
Update1.74ms
Delete2.14ms

Join Performance (hash join)

TablesResult RowsTime
50 users x 500 posts5001.78ms
100 users x 1000 posts1,0001.50ms
100 users x 5000 posts5,00032.2ms

JOIN Types (10K x 10K rows)

JOIN TypeTimeThroughput
INNER JOIN45ms2.2M rows/s
LEFT JOIN52ms1.9M rows/s
RIGHT JOIN51ms1.9M rows/s
FULL JOIN68ms1.5M rows/s
CROSS JOIN180ms555K rows/s
NATURAL JOIN48ms2.1M rows/s

Aggregate Functions (1M rows, SIMD-accelerated)

FunctionTimeNotes
COUNT(*)2.1msO(1) via counter
SUM(col)8.5msSIMD i64x4
AVG(col)8.7msSIMD i64x4
MIN(col)12msFull scan
MAX(col)12msFull scan

GROUP BY Performance (100K rows)

GroupsTimeNotes
1015msParallel aggregation
10018msHash-based grouping
1,00025msLow per-group overhead
10,00045msHigh cardinality

Row Count

RowsTime
10049us
1,000462us
5,0002.95ms

Analysis

  • Index acceleration: Hash indexes provide O(1) lookup for equality conditions
    • 40x speedup for equality queries matching 2% of rows
    • 1,604x speedup for single-row _id lookups
  • Full scan cost: Without index, O(n) for all queries (parallelized for

    1000 rows)

  • Batch insert: 2x faster than individual inserts (688K/s vs 320K/s)
  • Tensor-native evaluation: evaluate_tensor() evaluates conditions directly on TensorData, avoiding Row conversion for non-matching rows
  • Parallel operations: update/delete/create_index use rayon for condition evaluation
  • Index maintenance: Small overhead on insert/update/delete to maintain indexes
  • Join complexity: O(n+m) hash join for INNER/LEFT/RIGHT/NATURAL; O(n*m) for CROSS
  • Aggregate functions: SUM/AVG use SIMD i64x4 vectors for 4x throughput improvement
  • GROUP BY: Hash-based grouping with parallel per-group aggregation

Competitor Comparison

OperationNeumannSQLiteDuckDBNotes
Point lookup (indexed)2.9us~3us~30usB-tree optimized
Full scan (5K rows)5.3ms~15ms~2msDuckDB columnar wins
Aggregation (1M rows)8.5ms~200ms~12msSIMD-accelerated
Hash join (10Kx10K)45ms~500ms~35msParallel execution
Insert (single row)3.1us~2us~5usSQLite B-tree optimal
Batch insert (1K rows)1.5ms~8ms~3msNeumann batch-optimized

Design Trade-offs

  • vs SQLite: Neumann trades SQLite’s proven stability for tensor-native storage and SIMD acceleration. SQLite wins on point lookups; Neumann wins on analytics.
  • vs DuckDB: Similar columnar design. DuckDB has more mature query optimizer; Neumann has tighter tensor integration and lower memory footprint.
  • Unique to Neumann: Unified tensor storage enables cross-engine queries (relational + graph + vector) without data movement.