Why PolarisDB?
PolarisDB is built for developers who need fast, local vector search without the complexity of external services.
PolarisDB
| Runs 100% locally | |
| Data never leaves your machine | |
| Zero network latency | |
| Free forever — no usage fees | |
| Pure Rust — no C++ deps |
Cloud Vector DBs
| Requires internet connection | |
| Data on third-party servers | |
| Network round-trip latency | |
| Pay-per-query pricing | |
| Often wrapped C++ libraries |
Built for: RAG applications · Semantic search · Recommendations · Edge AI · Game AI
Features
High-Performance Indexing
| Index Type | Use Case | Complexity |
|---|---|---|
| BruteForce | Small datasets (<10K vectors) | O(n) exact |
| HNSW | Large datasets (millions) | O(log n) approximate |
Distance Metrics
Euclidean // L2 distance
Cosine // Angular similarity (text embeddings)
DotProduct // Maximum inner product
Hamming // Binary vectors
Metadata Filtering
Combine vector similarity with metadata conditions:
// Find similar documents from 2024 in the "AI" category
let filter = field.eq
.and;
let results = index.search;
Durable Persistence
- Write-Ahead Log (WAL) for crash safety
- Automatic recovery on restart
- Memory-mapped files for efficient disk access
Async Support
// Enable with: polarisdb = { version = "0.1", features = ["async"] }
let collection = open_or_create.await?;
collection.insert.await?;
let results = collection.search.await;
Python Bindings
# Persistent Collection
=
=
LangChain Integration
Use PolarisDB as a vector store in your RAG pipelines:
# Create vector store from documents
=
# Similarity search
=
# Use as retriever in RAG chain
=
See examples/langchain_rag.py for a complete RAG example.
HTTP Server
Run the standalone server:
Integrate via REST API:
Quick Start
Add PolarisDB to your Cargo.toml:
[]
= "0.1"
Basic Usage
use *;
High-Performance HNSW Index
For millions of vectors, use the HNSW index:
let config = HnswConfig ;
let mut index = new;
// Insert vectors
for in documents
// Search with ~9x speedup over brute-force
let results = index.search;
Pre-Filtered Search with Bitmap Index
For highly selective filters:
// Build a bitmap index alongside your vector index
let mut bitmap = new;
let mut hnsw = new;
for in documents
// Query with bitmap pre-filtering
let filter = field.eq;
let valid_ids = bitmap.query;
let results = hnsw.search_with_bitmap;
Examples
Run the included examples:
# HNSW performance benchmark (9x speedup demo)
# Async concurrent insertions
# Pre-filtering benchmark
# Ollama RAG integration (requires Ollama running)
Performance
Benchmarked on M1 MacBook Pro with 128-dimensional vectors (Cosine distance):
| Operation | Vectors | Time | Throughput |
|---|---|---|---|
| Brute Force Search | 1,000 | 325 µs | 3.1M elem/s |
| Brute Force Search | 10,000 | 5.5 ms | 1.8M elem/s |
| Brute Force Search | 50,000 | 34 ms | 1.5M elem/s |
Distance Calculations (SIMD-optimized)
| Dimension | Dot Product | Throughput |
|---|---|---|
| 128 | 81 ns | 1.6 Gelem/s |
| 384 | 155 ns | 2.5 Gelem/s |
| 768 | 154 ns | 5.0 Gelem/s |
| 1536 | 304 ns | 5.1 Gelem/s |
Scaling Projections
| Vectors | HNSW Search Time | Memory |
|---|---|---|
| 10K | ~500 µs | 12 MB |
| 100K | ~600 µs | 120 MB |
| 1M | ~800 µs | 1.2 GB |
HNSW search time scales logarithmically. Brute force scales linearly.
Documentation
- 📖 API Reference — Complete rustdoc documentation
- 📚 Examples — Working code examples
- 🔧 CONTRIBUTING.md — Development guide
- 📝 CHANGELOG.md — Version history
Architecture
polarisdb/
├── polarisdb-core/ # Core library (distance, indexing, storage)
│ ├── index/ # BruteForce, HNSW implementations
│ ├── storage/ # WAL, persistence layer
│ └── filter/ # Bitmap filtering
│
├── polarisdb/ # Main crate (convenient re-exports)
├── polarisdb-server/ # HTTP API server (axum)
└── py/ # Python bindings (pyo3 + maturin)
Roadmap
- v0.1 — Core functionality, brute-force search, filtering
- v0.2 — WAL persistence, crash recovery
- v0.3 — HNSW approximate nearest neighbor
- v0.4 — Bitmap pre-filtering, async API, SIMD acceleration
- v0.5 — Python bindings, PyPI release
- v0.6 — LangChain integration, multi-vector queries
- v1.0 — Stable API, product quantization, hybrid search
Comparison
| Feature | PolarisDB | LanceDB | Chroma | Qdrant |
|---|---|---|---|---|
| Language | Rust | Rust/Python | Python | Rust |
| Embedded | Partial | |||
| Python Bindings | ||||
| HNSW | ||||
| Persistence | ||||
| Filtering | ||||
| Async | ||||
| SIMD |
Contributing
We welcome contributions! See CONTRIBUTING.md for guidelines.
# Clone and build
# Run tests
# Run clippy
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE or http://opensource.org/licenses/MIT)
at your option.
Acknowledgments
- HNSW Paper — Hierarchical Navigable Small World graphs
- Roaring Bitmaps — Compressed bitmap data structure
- The Rust community