Architecture & Core Concepts
Unified ACID/MVCC + SSI transactions, row/columnar/schemaless storage, multi-tenancy, and protocol selection.
SpydDB unifies transactional OLTP storage, analytical columnar segments, schema-flexible JSON documents, BM25 full-text search, HNSW vector search, R-Tree geospatial queries, streaming change capture, and OpenTelemetry observability into a single Rust storage and execution engine.
Single-Snapshot ACID & SSI Guarantee#
Every statement — whether submitted over SpydQL, PostgreSQL wire (:5432), SpydWire (:5433), HTTP JSON (:8080), or Embedded Web Studio — executes inside one MVCC + Serializable Snapshot Isolation (SSI) transaction boundary:
- No eventual-consistency sync lag: Secondary B-Tree indexes, BM25 full-text inverted indexes, HNSW vector graphs, R-Tree geo indexes, and keyed HMAC blind indexes commit in the exact same atomic WAL transaction as the primary row.
- No split security perimeter: Role-Based Access Control (RBAC), row-level
filteranddenypolicies, role-scoped field masks, ABAC session attributes, and SHA-256 hash-chained audit logging apply uniformly across every protocol listener.
Multi-Model Storage Layouts#
| Model / Layout | Declaration | Best Fit |
|---|---|---|
| Row Store (B+ Tree) | create collection users { id: u64 primary, ... } | Point lookups, high-concurrency OLTP updates, unique constraints, foreign keys |
| Columnar / PAX Segments | store column for (ts, service, latency_ms) or columnar | Wide analytical scans, group-by aggregations, zone-map min/max pruning, cold archival |
| Schemaless JSON Documents | create collection events { id: u64 primary, schemaless } | Rapidly evolving event payloads, flexible metadata, json_text() extraction |
| Time-Ordered Data Streams & ILM | create data stream logs on events by ts stages { hot, warm after 7d, delete after 30d } | Append-heavy logs, telemetry, automated warm compaction and TTL expiry |
Automatic Hot / Cold Tiering#
Row-oriented collections can age inactive rows into compressed immutable columnar segments automatically (tiering_interval_secs, hot_cold_threshold_secs) while keeping 100% of historical rows transparently queryable from the same SQL/SpydQL statements.
Logical Boundaries: Databases vs. Multi-Tenancy#
SpydDB supports two distinct isolation primitives:
- Databases (
CREATE DATABASE/X-Spyd-Database/use_database):- Separate catalogs, collections, roles, policies, and search paths inside one
spyd-serverprocess. - Manage dynamically over
pgwire(CREATE DATABASE analytics) or the Admin REST API (/v1/admin/databases), and select per session viause_database("analytics")or HTTP headerX-Spyd-Database: analytics.
- Separate catalogs, collections, roles, policies, and search paths inside one
- Physical Multi-Tenancy (
security.multi_tenant_enabled):- Prefixes every row key, index entry, encryption envelope AAD, and columnar segment family with an immutable 8-byte
tenant_idbound directly to the authenticated credential. - Enforces independent per-tenant byte/row quotas and per-query memory, wall-clock, and row limits.
- Prefixes every row key, index entry, encryption envelope AAD, and columnar segment family with an immutable 8-byte
Choosing Your Protocol#
| Protocol | Port | Transport | Best For |
|---|---|---|---|
SpydWire (SPD2) | 5433 | Framed TCP/TLS | Lowest latency across all 10 native SDKs with full typed precision (u64, Decimal, Vector, GeoPoint) |
PostgreSQL Wire (v3) | 5432 | TCP / SSLRequest TLS | Existing tools (psql, DataGrip, DBeaver), Python psycopg/SQLAlchemy, Node pg, Java JDBC, ODBC, BI connectors |
| HTTP/1.1 & OTLP | 8080 | HTTPS REST & Protobuf/JSON | Serverless/edge functions, browser SPAs, curl, admin automation, OpenTelemetry ingestion (/v1/traces, /v1/metrics, /v1/logs) |
| gRPC / OTLP | configured grpc_bind | HTTP/2 TLS | High-throughput OpenTelemetry Collector pipelines |
Next Steps#
- Configure listeners, TLS, and memory pinning in Installation & Configuration.
- Master the query pipeline syntax in SpydQL Overview.
- Pick your language SDK in SDKs & Drivers Overview.