HexxlaDB uses a hexagonal coordinate grid where every data cell lives at a specific coordinate. This spatial addressing enables deterministic ring walks, efficient neighborhood queries, and physical locality in the on-disk format.Documentation Index
Fetch the complete documentation index at: https://hexxladb.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Axial coordinates
Cells are addressed by axial coordinates(q, r) with implicit cube coordinate s = -q - r:
- Each cell has exactly six symmetric neighbors
- Ring walks and radius-bounded expansion are deterministic
- Distance between cells is exact and computable
Hex distance formula
The distance between two cells is derived from cube Manhattan distance:Coordinate methods
TheCoord type provides several utility methods:
Morton packing
For storage, coordinates are Morton-encoded into a 128-bitPackedCoord:
- Preserves spatial locality in the B+ tree
- Nearby coordinates have nearby keys
- Ring walks become efficient prefix scans
- Scales with ring area, not database size
Ring walks
A ring walk visits all cells at a fixed distance from a center:- Same order every time
- Axial spiral order within each ring starting from positive-q direction
- Stable across database size
Ring walks with validity filtering
For time-travel queries, filter by validity window:Context loading
Load a neighborhood around a center coordinate:LoadContext returns cells in concentric rings from center outward, then axial spiral order within each ring.
Coordinate selection strategies
Choosing where to place cells is application-specific:Semantic clustering
Place semantically related content near each other:- Architecture decisions in one region
- Bug reports in another
- User preferences in a third
Temporal clustering
Place temporally related content together:- Session-based regions
- Time-based rings
Random placement
For simple use cases, random coordinates work fine:- Ring walks still provide locality
- HNSW embedding search finds relevant content
Hybrid approaches
Combine strategies:- Use embeddings for semantic search
- Use ring walks for context assembly
- Use edges for explicit relationships
Coordinate arithmetic
Why hexagonal?
A hexagonal lattice provides:- 6-neighbor connectivity — Natural for neighborhood queries
- Natural ring enumeration — Easy to define concentric rings
- Exact deterministic distance — No floating-point ambiguity
- Hierarchical clustering — Super-hex regions for multi-level summarization
See also
- Cells — Core data units at coordinates
- Context assembly — Budgeted neighborhood loading
- Storage layout — How coordinates are encoded on disk