NeurondB: AI Database Extension for PostgreSQL
Production-grade vector search with 52 ML algorithms, 473 SQL functions, GPU acceleration, and complete RAG pipeline, all within PostgreSQL
neurondb-demo
NeurondB Interactive Demo Terminal
Building and installing NeurondB extension for PostgreSQL
📦 Installation⚙️ Configuration🔧 Setup
Ready to demonstrate Build. Click "Run Demo" to begin.
Speed:
Ready to explore NeuronDB
PostgreSQL 16-185 Vector Types52 ML Algorithms473 SQL FunctionsGPU Acceleration4 Background Workers

Architecture

Complete AI database architecture with vector search, ML inference, and RAG pipeline

NeuronDB Architecture

PostgreSQL 16-18 CoreACID | MVCC | WAL | Replication | SPINeuronDB Extension LayerHooks: Executor | Planner | UtilityShared Memory | LWLocks | Background WorkersVector Engine• HNSW Indexing• IVF Indexing• Cosine/L2/Inner Product• Quantization (FP16/INT8/Binary)• Sparse Vectors (SPLADE/ColBERT)• SIMD-Optimized DistanceML Engine• Classification (RF/XGBoost/SVM)• Regression (Linear/Ridge/Lasso)• Clustering (KMeans/DBSCAN/GMM)• 52 ML Algorithms (Pure C)• ONNX Runtime Integration• Batch ProcessingEmbedding Engine• Text Embeddings (embed_text)• Batch Embeddings (embed_text_batch)• Multimodal (CLIP/ImageBind)• Hugging Face Integration• Cache Management• LLM Router & RuntimeGPU Accelerator• CUDA (NVIDIA)• ROCm (AMD)• Metal (Apple Silicon)• GPU Distance Ops• GPU ML Inference• Auto Detection & FallbackAdvanced FeaturesHybrid SearchRerankingRAG PipelineQuery PlannerSparse VectorsVector + FTSCross-Encoder/LLMDocument ProcessingCost EstimationSPLADE/ColBERTMulti-VectorMMR/RRF/EnsembleLLM IntegrationIndex SelectionBM25 ScoringBackground Workers (4)neuranq (Queue Executor)Async jobs, SKIP LOCKED, retriesneuranmon (Auto-Tuner)ef_search tuning, recall@k trackingneurandefrag (Index Maintenance)Compaction, tombstone pruningneuranllm (LLM Processor)LLM jobs, crash recoveryStorage & Index ManagerVector Storage (TOAST)Compressed storage, WAL integrationHNSW & IVF Index BuilderAutomatic creation, incremental updatesIndex Cache & BufferHot centroid caching, prefetchingSparse Vector IndexSPLADE, ColBERT indexingMonitoring & Analyticspg_stat_neurondb ViewQuery latency, cache hit ratesModel Metrics & AnalyticsAccuracy, F1, Recall@K, MRRPrometheus ExporterReal-time metrics, structured loggingMulti-Tenant IsolationTenant-aware metrics, RLSAPI & Interface Layer (473 SQL Functions)SQL FunctionsOperatorsViewsTypesAggregatesneurondb.train()<->, <#>, <=>pg_stat_neurondbvector, sparse_vectorvector_avg, vector_sumWeb ApplicationsReact, Next.js, VueML PipelinesPython, JupyterRAG SystemsLangChain, LlamaIndexSearch EnginesSemantic SearchAnalyticsBI Tools, DashboardsData FlowQueryResultsVector ProcessingML OperationsEmbedding GenerationGPU AccelerationData FlowCore Components

Vector Engine

High-performance ANN search with HNSW and IVF indexing, supporting multiple distance metrics (L2, Cosine, Inner Product), quantization (FP16/INT8/Binary), and SIMD-optimized operations. Pure C implementation with 158 source files.

ML Engine

52 ML algorithms implemented in pure C: Random Forest, XGBoost, LightGBM, CatBoost, SVM, KNN, Decision Trees, Naive Bayes, Neural Networks, K-means, DBSCAN, GMM, PCA, and more. ONNX runtime integration for model inference.

Embedding Engine

Text embeddings via embed_text() and embed_text_batch() functions. Multimodal support (CLIP, ImageBind). Hugging Face integration. LLM router and runtime with caching. Batch generation with GPU acceleration.

GPU Accelerator

Full GPU support: CUDA (NVIDIA), ROCm (AMD), Metal (Apple Silicon). GPU-accelerated distance calculations, ML inference, and batch processing. Automatic GPU detection with CPU fallback. Native C/C++ implementation.

Background Workers (4)

neuranq (async job queue), neuranmon (auto-tuner), neurandefrag (index maintenance), neuranllm (LLM processor). All tenant-aware with QPS/cost budgets, crash recovery, and SKIP LOCKED processing.

Advanced Features

Hybrid search (vector + FTS), reranking (cross-encoder, LLM, MMR, RRF), complete RAG pipeline, sparse vectors (SPLADE, ColBERT), query planner with cost estimation, and intelligent caching.

Comprehensive AI Database Features

Why NeurondB

Vector Search & Indexing

5 production-grade vector types: vector (float32), vectorp (packed), vecmap (sparse map), vgraph (graph-based), rtext (retrieval text). HNSW and IVF indexing with automatic tuning. Multiple distance metrics: L2 (Euclidean), Cosine, Inner Product, Manhattan, Hamming, Jaccard. Product Quantization (PQ) and Optimized PQ (OPQ) for 2x-32x compression.

ML & Embeddings

52 ML algorithms implemented in pure C: Random Forest, XGBoost, LightGBM, CatBoost, Linear/Logistic Regression, Ridge, Lasso, SVM, KNN, Naive Bayes, Decision Trees, Neural Networks, Deep Learning. Built-in embedding generation with caching. ONNX runtime integration. Batch processing with GPU acceleration. Model catalog and versioning.

Hybrid Search & Retrieval

Combine vector similarity with full-text search (BM25). Weighted scoring (70% vector + 30% text). Multi-vector documents. Faceted search with category filters. Temporal decay for time-sensitive relevance. Optimal for real-world search scenarios.

Advanced Reranking

Cross-encoder neural reranking for precision improvement. LLM-powered scoring (GPT-4, Claude). ColBERT late interaction models. MMR (Maximal Marginal Relevance) for diversity. Ensemble strategies combining multiple rankers. Sub-10ms latency.

Complete RAG Pipeline

End-to-end Retrieval Augmented Generation in PostgreSQL. Document chunking and processing. Semantic retrieval with reranking. LLM integration for answer generation. Context management. Guardrails for content safety. Production-ready RAG in SQL.

Background Workers

4 production workers: neuranq (async job queue executor with SKIP LOCKED, retries, poison handling, batch processing), neuranmon (live query auto-tuner for search params, cache rotation, recall@k tracking), neurandefrag (automatic index maintenance, compaction, tombstone pruning, rebuild scheduling), neuranllm (LLM job processing with crash recovery). All tenant-aware with QPS/cost budgets.

ML Analytics Suite

Comprehensive analytics: K-means, Mini-batch K-means, DBSCAN, GMM, Hierarchical clustering (all GPU-accelerated). Dimensionality reduction: PCA, PCA Whitening, OPQ. Outlier detection: Z-score, Modified Z-score, IQR, Isolation Forest. Quality metrics: Davies-Bouldin Index, Recall@K, Precision@K, F1@K, MRR. Drift detection with temporal monitoring. Topic discovery and modeling.

GPU Acceleration

Full GPU support: CUDA (NVIDIA), ROCm (AMD), Metal (Apple Silicon). GPU-accelerated ML algorithms: Random Forest, XGBoost, LightGBM, Linear/Logistic Regression, SVM, KNN, Decision Trees, Naive Bayes, GMM, K-means. Batch distance computation (100x speedup). Automatic GPU detection with CPU fallback. Multi-stream compute overlap. Production-ready with memory management.

Performance & Optimization

SIMD-optimized distance calculations (AVX2, AVX-512, NEON). Intelligent query planning with cost estimates. ANN buffer cache for hot centroids. WAL compression with delta encoding. Parallel kNN execution. Predictive prefetching. Sub-millisecond searches on millions of vectors.

Enterprise Security

Vector encryption (AES-GCM via OpenSSL). Differential privacy for embeddings. Row-level security (RLS) integration. Multi-tenant isolation. HMAC-SHA256 signed results. Audit logging with tamper detection. Usage metering and governance policies. GDPR-compliant data handling.

Monitoring & Observability

pg_stat_neurondb view with real-time metrics. Worker heartbeats and watchdog. Query latency histograms. Cache hit rate tracking. Recall@K monitoring. Model cost accounting. Prometheus exporter ready. Structured JSON logging with neurondb: prefix.

PostgreSQL Native Architecture

Pure C implementation following 100% PostgreSQL coding standards. 144 source files + 64 headers, zero compiler warnings. PGXS build system. 473 SQL functions/types/operators. Shared memory for caching. WAL integration for durability. SPI for safe operations. Background worker framework. Standard extension, zero external dependencies, no core modifications.

Production Capabilities

Comprehensive AI database features built for enterprise production workloads

CapabilityDescriptionPerformanceProduction Ready
Vector SearchHNSW indexing, multiple distance metrics, quantizationSub-millisecond on millions
ML InferenceONNX runtime, batch processing, embedding generationHigh-throughput batch ops
Hybrid SearchVector + FTS, multi-vector, faceted, temporalOptimized query planning
RerankingCross-encoder, LLM, ColBERT, ensembleGPU-accelerated support
Background WorkersQueue executor, auto-tuner, index maintenanceNon-blocking async ops
RAG PipelineComplete in-database RAG with document processingEnd-to-end optimization
ML AnalyticsClustering (K-means, DBSCAN, GMM), PCA, outlier detection, quality metrics, drift detectionGPU-accelerated algorithms
GPU AccelerationCUDA (NVIDIA), ROCm (AMD), Metal (Apple), 100x speedup on batch opsAuto-detection with CPU fallback
Performance OptimizationSIMD (AVX2/AVX-512/NEON), intelligent query planning, ANN cache, WAL compressionPredictive prefetching
Enterprise SecurityVector encryption (AES-GCM), differential privacy, RLS integration, multi-tenant isolationGDPR-compliant
Monitoring & Observabilitypg_stat_neurondb view, worker heartbeats, latency histograms, Prometheus exporterReal-time metrics
PostgreSQL NativePure C implementation, 473 SQL functions, zero external dependencies, WAL integrationZero core modifications

NeurondB vs. Alternatives

Comprehensive comparison of NeurondB with other PostgreSQL AI and vector extensions

FeatureNeurondBpgvectorpgvectorscalepgaiPostgresML
Vector IndexingHNSW + IVFHNSW + IVFStreamingDiskANNUses pgvectorpgvector-based
ML InferenceONNX (C++)NoneNoneAPI callsPython ML libs
Embedding GenerationIn-database (ONNX)ExternalExternalExternal APIIn-database (Transformers)
Hybrid SearchNative (Vector+FTS)ManualManualManualManual
RerankingCross-encoder, LLM, ColBERT, MMRNoneNoneNoneNone
ML Algorithms52 algorithms: RF, XGBoost, LightGBM, CatBoost, SVM, KNN, DT, NB, NN, K-means, DBSCAN, GMM, PCA, etc.NoneNoneNoneXGBoost, LightGBM, sklearn suite, Linear/Logistic
Background Workers4 workers: neuranq, neuranmon, neurandefrag, neuranllmNoneNoneNoneNone
RAG PipelineComplete In-DBNoneNonePartial (API)Partial (Python)
QuantizationFP16, INT8, Binary (2x-32x)Binary onlyBinary onlyNoneNone
ImplementationPure CPure CPure CRust + SQLPython + C
Training ModelsFine-tuning (roadmap)NoneNoneNoneFull training (sklearn, XGBoost, etc.)
Auto-Tuningneuranmon workerNoneNoneNoneNone
GPU SupportCUDA + ROCm + Metal (native C/C++)NoneNoneNoneCUDA (via Python)
PostgreSQL Versions16, 17, 1812-1815-1816-1814-16
LicensePostgreSQLPostgreSQLTimescale LicensePostgreSQLPostgreSQL
Vector Types5 types: vector, vectorp, vecmap, vgraph, rtext1 type: vector1 type: vectorUses pgvectorUses pgvector
Distance Metrics10+ metrics: L2, Cosine, Inner Product, Manhattan, Hamming, Jaccard, etc.3 metrics: L2, Cosine, Inner Product3 metrics: L2, Cosine, Inner ProductUses pgvectorUses pgvector
SQL Functions473 functions~20 functions~30 functions~15 functions~50 functions
Index MaintenanceAuto (neurandefrag worker)ManualManualManualManual
Performance (QPS)100K+ (with GPU)10K-50K50K-100KLimited (API overhead)5K-20K (Python overhead)
Memory EfficiencyOptimized (PQ/OPQ compression)StandardDisk-based (low memory)StandardHigh (Python models)
Multi-tenancyNative (tenant-aware workers)NoneNoneNoneNone
SecurityRow-level security, encryption, audit logsPostgreSQL RLSPostgreSQL RLSPostgreSQL RLSPostgreSQL RLS
Monitoringpg_stat_neurondb, Prometheus, GrafanaBasicBasicBasicLimited
DocumentationComprehensive (473 functions documented)GoodModerateModerateGood
Community SupportActive (pgElephant)Very Active (Anthropic)Moderate (Timescale)GrowingActive
Production ReadinessEnterprise-readyProduction-readyBetaEarly stageProduction-ready
DependenciesZero (pure C, optional ONNX)Zero (pure C)Zero (pure C)Rust runtimePython + ML libraries
Batch ProcessingNative (neuranq worker)ManualManualLimitedNative (Python)
Model CatalogBuilt-in (versioning, A/B testing)NoneNoneNoneBasic
Cost EfficiencyHigh (in-DB, no API costs)High (in-DB)High (disk-based)Low (API costs)Moderate (Python overhead)
Get Started

Add AI Capabilities to PostgreSQL

Install NeurondB. Build semantic search, RAG applications, and ML features in your PostgreSQL infrastructure.