Skip to content

Architecture Overview

ParticleDB is a hybrid transactional/analytical processing (HTAP) database. A single process serves both OLTP point lookups and OLAP analytical queries over the same data, eliminating the need for separate ETL pipelines between operational and analytical systems.

┌──────────────────────────────────────────────────────────────────┐
│ Client Connections │
│ PostgreSQL Wire │ gRPC │ HTTP/REST + SSE │ Redis RESP │
└────────┬─────────┴───┬──┴───────┬─────────┴──────┬───────────────┘
│ │ │ │
┌────────▼─────────────▼──────────▼────────────────▼──────────────┐
│ Network Layer │
│ Protocol handlers, TLS, auth, routing │
└────────────────────────────┬────────────────────────────────────┘
┌────────────────────────────▼────────────────────────────────────┐
│ SQL Parser & Planner │
│ Parse → AST → Logical Plan → Optimize → Physical Plan │
└────────────────────────────┬────────────────────────────────────┘
┌────────────────────────────▼────────────────────────────────────┐
│ Query Execution Engine │
│ Vectorized columnar execution · Parallel across CPU cores │
└─────────┬──────────────────────────────────┬────────────────────┘
│ │
┌─────────▼──────────┐ ┌────────────▼────────────────────┐
│ Transaction Engine │ │ Vector Index │
│ MVCC · WAL · 2PC │ │ HNSW · IVFFlat │
└─────────┬──────────┘ └─────────────────────────────────┘
┌─────────▼──────────────────────────────────────────────────────┐
│ Storage Engine │
│ Columnar persistent storage · Write-Ahead Log · Compression │
└─────────────────────────────────────────────────────────────────┘

The SQL layer parses incoming queries into an abstract syntax tree and transforms them through a series of optimization passes before producing a physical execution plan.

OptimizationDescription
Predicate pushdownPushes WHERE filters through projections, joins, and into scans to reduce rows early
Projection pushdownNarrows scan projections to only the columns referenced by the query
Constant foldingEvaluates constant sub-expressions at plan time
Join reorderingCost-based: flattens multi-way inner joins, sorts by estimated cardinality
Plan cacheNormalized SQL text maps to cached physical plans; cleared on DDL changes

The engine executes plans using vectorized columnar operators that run in parallel across CPU cores. Aggregates resolve from precomputed metadata when possible, so queries like SELECT COUNT(*) or SELECT MAX(price) return without scanning rows.

ParticleDB provides MVCC with snapshot isolation. Three WAL synchronization modes trade durability for throughput:

ModeBehaviorUse case
syncPer-entry fsyncMaximum durability
groupsyncBatched fsync across transactionsBalanced (default)
nosyncWAL writes skipped entirelyMaximum throughput

Row-level locking supports FOR UPDATE / FOR SHARE with SKIP LOCKED and NOWAIT.

See the Transaction Engine deep dive for full details.

ParticleDB exposes multiple server protocols through a single process, so applications can connect with whichever protocol fits their stack:

ProtocolDefault PortPrimary Use
PostgreSQL wire5432SQL access, ORM compatibility
gRPC26257Typed RPC, batch execution, CDC
HTTP / REST8080JSON SQL, status endpoints, SSE
Redis RESP6379Key-value and data-structure access

All protocols share the same underlying storage and transaction engine, so data written via one protocol is immediately visible through any other.

ParticleDB includes built-in vector similarity search without external plugins:

  • HNSW (Hierarchical Navigable Small World) for high-recall approximate nearest neighbor search.
  • IVFFlat (Inverted File with Flat quantization) for large-scale workloads.
  • Distance metrics: L2 (Euclidean), Cosine, and Inner Product.

Vector columns are defined with standard SQL DDL and queried with the <-> operator or the vector_search() function. See Vector Search for SQL syntax.

  1. Single binary — one binary contains the full database. No JVM, no external dependencies, no sidecar processes.
  2. Columnar-first — analytical queries scan only the columns they need.
  3. Protocol diversity — multiple server interfaces let you use the right tool for each workload without proxies or adapters.
  4. HTAP by design — OLTP and OLAP share the same storage and transaction engine rather than replicating data between separate systems.