Columnar Storage in Go: Fast Financial Aggregation

Consider a financial analytics platform serving real-time portfolio metrics to thousands of clients. Traditional row-oriented storage loads entire transaction records into memory—customer ID, timestamp, instrument, quantity, price, fees—even when clients only request daily trade volumes. At 10 million transactions per day with 50-byte records, this means loading 500MB to calculate a single sum. By switching to columnar storage where each field lives in its own contiguous array, the same aggregation touches only 40MB (the price column), fits in CPU cache, and completes 18× faster. The architecture shift isn’t just about memory efficiency. It’s about aligning data layout with how modern CPUs actually process numerical operations. ...

March 26, 2025 · 21 min · 4400 words · Svein Erik

Building a Time Series Database in Go

Time series databases (TSDBs) are specialized storage engines optimized for time-stamped data at massive scale. Unlike general-purpose databases, TSDBs exploit temporal locality, high write throughput, and read patterns dominated by range queries and aggregations. This article explores the architecture, algorithms, and implementation techniques for building a production-grade TSDB in Go, examining both storage and query engines with mathematical analysis of performance characteristics. Modern observability platforms like Prometheus, Grafana, and Datadog rely on time series databases to handle billions of metrics per second. These systems face unique challenges: metrics arrive continuously at high velocity, queries scan large time ranges for trend analysis, and storage costs must remain manageable despite exponential data growth. A general-purpose database like PostgreSQL or MongoDB would struggle under this workload—the access patterns are fundamentally different from transactional (OLTP) or analytical (OLAP) systems. ...

June 11, 2023 · 44 min · 9276 words · Svein Erik