narrowdb
A lightweight columnar database for log and time-series data, written in Rust.
Quick start
# Create a table and insert data
# Query with filters, aggregation, and ordering
As a library
[]
= "0.1"
use ;
let mut db = open?;
db.execute_sql?;
db.insert_rows?;
let results = db.execute_sql?;
TCP server
The repo also includes a separate runnable server crate in crates/server.
It speaks the PostgreSQL wire protocol over TCP with password auth.
Example connection:
PGPASSWORD=secret
Example SQL:
(ts TIMESTAMP, service TEXT, status INT);
INSERT INTO logs VALUES (1, 'api', 200);
SELECT * FROM logs;
Benchmarks
1M rows, Apple Silicon, release build:
| Metric | Result |
|---|---|
| Ingest throughput | ~8.5M rows/sec |
| Bytes per row | 56 |
| Filtered GROUP BY | ~2.6ms |
| Filtered AVG | ~0.9ms |
| Filtered COUNT | ~0.8ms |
| Reopen from disk | ~0.7ms |
License
MIT