The history of how humanity manages data is not just a technological timeline; it is fundamentally a story about our changing relationship with time and memory in digital form. From the moment we started scratching cuneiform on clay tablets, we sought to capture a record. The modern database system, however, has evolved from a simple recorder of the “now” to a dynamic, four-dimensional steward of the entire “story”. Join us on this grand odyssey through the architectural revolutions that redefined data storage. Act I: The Age of Rigidity (1890s - 1990s) The first mechanical memory was born in 1890 when Herman Hollerith adapted punched cards for the U.S. Census, dramatically cutting the tabulation time and laying the groundwork for IBM. This mechanical era gave way to electronic databases in the 1960s, driven partially by the NASA moon race. This period was dominated by Navigational Databases: * Hierarchical Models: IBM’s Information Management System (IMS, 1968), created for the Apollo program’s monumental Bill of Materials, organized data as parent-child trees. * Network Models: The CODASYL standard allowed more flexible, spiderweb-like relationships using physical pointers. These systems were blazingly fast for the queries they anticipated, but they were rigid; accessing data in an unanticipated way was cumbersome. The Relational Hegemony The watershed moment came in 1970 with E.F. Codd’s introduction of the Relational Model. Codd proposed separating the logical schema (tables, rows, and columns) from the physical storage, enabling users to declare what data they wanted without knowing how to navigate the pointers. This led to the creation of SQL, the lingua franca of data, and established Relational Database Management Systems (RDBMS) as the gold standard by the 1980s. RDBMSs guaranteed ACID transactions (Atomicity, Consistency, Isolation, Durability) and were universally powered by the B-Tree data structure. Act II: The Great Architectural Pivot (2000s) The relational model excelled at transactional integrity, but it came with a fundamental flaw for the web era: its reliance on B-Trees mandated an update-in-place philosophy, which destroyed the historical context of data. A bank balance was simply overwritten. The “big data” explosion - the need to ingest millions of machine-generated events per second - broke the B-Tree architecture. Why? * Random I/O on Writes: Updating a B-Tree requires modifying scattered internal nodes, leading to excessive random I/O operations and severe bottlenecks. * Write Amplification: To ensure durability, RDBMSs often write data multiple times (to the Write-Ahead Log, and then to the B-Tree page), doubling or tripling the I/O load. The solution lay in the emergence of NoSQL and a fundamental architectural divergence: the Log-Structured Merge (LSM) Tree. MetricB-Tree (RDBMS)LSM Tree (TSDB/NoSQL)ImplicationsWrite PatternRandom I/O (Update-in-place)Sequential I/O (Append-only)LSM is superior for ingestion speed. Write AmplificationHigh (WAL + Page splits)Lower (Sequential flush)LSM minimizes immediate I/O but pays a deferred cost during compaction. Read AmplificationLow (Direct seek)Higher (Must check multiple files)LSM reads may degrade if compaction lags. LSM trees, popularized by Google’s BigTable, prioritize sequential disk writes, which are orders of magnitude faster than random writes. Data is first written to a fast in-memory Memtable and simultaneously appended to a sequential Write-Ahead Log (WAL) for durability. When the Memtable fills, it is flushed to disk as an immutable Sorted String Table (SSTable). Background Compaction processes merge these files, discarding old data. This architecture was not just a technical optimization; it was a philosophical acceptance that storage is cheap, but random I/O is expensive, dictating the software design of the last decade. Act III: Time Becomes the Primary Dimension As storage costs plummeted, the focus moved from merely recording the “now” to capturing the “forever,” treating time not just as an attribute but as a primary dimension. This drove the evolution of Time Series Databases (TSDBs). TSDBs are designed specifically for data points with timestamps (like sensor readings or metrics) and are typically append-only, using columnar formats and heavy compression. GenerationKey SystemInnovation / MechanismFixed-Size Era (Gen 1)RRDTool (1999)Used a circular buffer (Round Robin Archive) with a fixed size, automatically downsampling and overwriting old data to maintain history. Scalable Era (Gen 2)OpenTSDB (2010)Built on HBase (Hadoop/BigTable), it introduced tags (key-value pairs) attached to metrics, solving the scale problem. Cloud-Native Era (Gen 3)InfluxDB (2013)Used a specialized LSM variant (TSM Engine) and advanced compression techniques, achieving a 12x reduction in storage requirements. Prometheus (2012/2015)Introduced the pull model (server scrapes metrics from applications) and the powerful query language PromQL. Solving High Cardinality As microservices and ephemeral infrastructure rose, the High Cardinality Problem emerged: tagging metrics with unique IDs (like container_id or user_id) caused indexes to explode in size. Modern TSDBs address this by: * Columnar Storage: Systems like GreptimeDB and QuestDB shift away from inverted indexes, storing data by column to leverage vectorized execution (SIMD) for scanning billions of rows quickly. * Hybrid Partitioning: TimescaleDB (built on PostgreSQL) uses “hypertables” partitioned by time and secondarily by a spatial dimension (like device ID), constraining B-Tree index size. Act IV: The Pursuit of Narrative Integrity The quest for a perfect history extends beyond performance into the realm of semantic correctness and verifiable truth. * Temporal Databases: These systems track Bi-temporal data: Valid Time (when a fact was true in the real world) and Transaction Time (when the fact was recorded in the database). This is critical for regulated industries requiring auditable retroactive corrections. * Event Sourcing: This philosophy stores the entire stream of events - the immutable log - that led to the current state (e.g., Deposited($50) rather than simply updating the Balance). The current state is derived by replaying the log, providing perfect auditability. * Immutable Ledgers: Taking auditability one step further, ledgers like immudb ensure that even an administrator cannot tamper with history. They utilize Merkle Trees (Hash Trees) to generate a single “Root Hash”. If a single byte in a historical record changes, the root hash changes, providing cryptographic proof of unaltered history. Conclusion: The Polyglot Future The evolution of database systems has demonstrated a clear trajectory: from the destruction of history in mutable B-Trees to the preservation and cryptographic verification of the complete narrative. Today’s architects embrace polyglot persistence, realizing that different problems require specialized tools. An application might use a distributed relational database (NewSQL) for consistency, an LSM-based TSDB (like InfluxDB) for high-speed metrics ingestion, and a graph database (Neo4j) for relationships. Furthermore, the cloud era has shifted database management from on-premises hardware to Database-as-a-Service. Managed, serverless offerings like Amazon Aurora automatically scale compute and storage, promising that you only pay for what you use and never worry about provisioning. The database has evolved from a static file system into an elastic, living record of truth. The saga continues, driven by the persistent human desire to efficiently organize and trust the world’s information. This is a public episode. If you would like to discuss this with other subscribers or get access to bonus episodes, visit frahlg.substack.com
Audio and video play straight from the show's own hosting. PodSubs stores and serves no media.
Transcript
From the show. Tap a time to play from there.
SPEAKER_01Welcome to the Deb Dive. Today we're tracking a revolution in information infrastructure. It's a shift so fundamental it it really changes how you understand your entire operation. For you, Frederick, running Sourceful Energy, your legacy systems were built on a core premise.
SPEAKER_00The state.
SPEAKER_01Right. You needed to know definitively, you know, what is the current inventory? What is the precise bank balance or the current temperature of that expensive turbine? And that focus on state made perfect sense in the era of, you know, transactional processing. But now as you ingest petabytes of continuous high frequency sensor readings. Data that's arriving faster than any traditional system was ever designed to handle.
SPEAKER_00Exactly. The required question changes entirely. It's no longer about the current state. It's about the narrative. How did the turbine get to this exact state? What were the millisecond by millisecond pressure readings leading up to that safety cutoff?
SPEAKER_01And this is more than just a preference for more data. It's an infrastructure constraint, right? It's imposed by velocity and by volume. Traditional databases physically cannot handle the flow of machine-generated metrics without just collapsing.
SPEAKER_00So that sets our mission for this deep dive. We are unpacking the evolution of time series databases. We call them TSDBs.
SPEAKER_01And we have sources that detail the whole story, the historical roots from ancient accountability ledgers all the way through to the massive engineering challenges of the space race.
SPEAKER_00We'll dive deep into the intense, almost binary engineering trade-offs, the fundamental battle between B-trees and what are called log-structured merge trees, or LSMs.
SPEAKER_01And finally, we'll explore the modern strategic challenges, like the high cardinality crisis, that really define the specialized systems you rely on for monitoring, for predictive maintenance, and for energy compliance.
SPEAKER_00We're going to show you why these systems are not just faster, but fundamentally philosophically different from their relational ancestors.
SPEAKER_01Okay, so let's unpack the roots of this problem.
SPEAKER_00Let's do it.
SPEAKER_01To really grasp the architecture of modern TSDPs, we have to first understand the architecture of what they replaced. We're tracing what our sources call the grand database odyssey. And it starts with this foundational desire for, well, externalized memory. That desire is ancient, of course.
SPEAKER_00Oh, for sure. But the mechanical past really begins in 1890 with a man named Herman Hollerith. He took the punched card, which was previously used to control weaving loons, of all things, and he adapted it for the U.S. Census.
SPEAKER_01The sheer volume of data just required automation. I think one source said a hand tabulation had taken seven years in the previous census.
SPEAKER_00Seven years. Hollerith's electromechanical tabulator finished the 1890 count in just two. This was the birth of data automation, all based on mechanical sequential records. It laid the direct groundwork for IBM.
SPEAKER_01But the first true database management system software, that didn't really emerge until the 1960s. And it was driven by these massive, almost existential national projects that demanded extremely structured data handling. We call these the navigational databases. And the most famous example is IBM's Information Management System, or IMS.
SPEAKER_00What's fascinating is its origin story. It was literally a product of the space race.
SPEAKER_01Really?
SPEAKER_00Yeah. In 1965, NASA desperately needed a way to manage the monumental bill of materials, the bomb for the Apollo program's Saturn V rocket.
SPEAKER_01Right. A rocket with, what, millions of parts?
SPEAKER_00Over two million parts. They needed to know what part went where, and if they changed one single part, what was the cascading effect on everything else?
SPEAKER_01So IMS solved this using a strict hierarchical model. The data was organized as a giant tree.
SPEAKER_00A parent record, like the second stage of the rocket, could have multiple children, the fuel lines, the engines, and so on. It mirrored the real-world structure perfectly, and it made predefined lookups.
SPEAKER_01Like, tell me every single part needed for this subassembly.
SPEAKER_00Exactly. It made those lookups lightning fast and incredibly efficient.
SPEAKER_01And at the same time, you had another model emerging.
SPEAKER_00Right. Concurrently, you had Charles Bachman developing the codicidal network model. It was a bit more flexible than the strict hierarchy. It allowed records to be connected by many different pointers, sort of like a complex spiderweb. Both of these models were masters of efficiency on the hardware of the time,
SPEAKER_01which was expensive and very limited.
SPEAKER_00They were. They often retrieved physically related data contiguously, maximizing those precious I.O. cycles. But this incredible hardware optimized efficiency came at a huge cost. Inflexibility. If you want to query the data in a way the original hierarchy hadn't anticipated, you were in trouble. It became incredibly cumbersome. It required custom programming just to chase physical pointers through the data. You had to know how the data was physically stored. You had to navigate the database. And this inflexibility, this is what led to the great watershed moment.
SPEAKER_00Edgar F. Codd's 1970 paper introducing the relational model. The RDBMS Codd's innovation was revolutionary, precisely because it introduced what he called data independence. It separated the logical schema, the tables, rows, and columns we all know from the physical storage details.
SPEAKER_01So users could finally just state what data they wanted using SQL, and the database engine would figure out how to go and get it. And this, of course, led to the dominance of online transaction processing, or OLTP. The RDBMS became the gold standard, promising these things called ACD properties. Atomicity, consistency, isolation, and durability. This is key, Frederick. The RDBMS architecture was designed to guarantee that when a bank balance updates from $100 to $50, the result is definitive and consistent right now.
But that transactional integrity was built upon an underlying structure that would eventually fail and fail catastrophically when confronted with your massive streams
SPEAKER_00of time series data. And that structure is the B-tree. Okay, let's unpack the B-tree architecture before we talk about why it broke.
SPEAKER_01The B-tree, or more specifically the B-plus tree, is the standard structure underlying most relational databases like Oracle and PostgreSQL.
SPEAKER_00Right. It's a self-balancing tree structure and is optimized primarily for random access and for read consistency.
SPEAKER_01How does it work mechanically?
SPEAKER_00It works by segmenting data into blocks or pages. These are typically 4KB or 16KB, sized perfectly for block-oriented storage like hard disks.
SPEAKER_01The old spinning platters.
SPEAKER_00Exactly. So when you look up a record, the database traverses the tree from the root, reading only the minimal number of pages necessary until it hits the final leaf node that contains the data pointer. And this is why looking up a specific customer record is incredibly fast and
SPEAKER_01consistent without how large the database gets.
SPEAKER_00Perfect for that transactional world. But why does this perfect transactional structure fail so catastrophically when you
SPEAKER_01subject it to high-velocity, append-heavy time series data, like the thousands of readings you get every second? It comes down to its central tenet, the update-in-place philosophy.
SPEAKER_00Okay. The first killer problem for ingestion is random I.O. on writes. When you insert new data or you update an existing value, the B-tree has to modify nodes that are structurally scattered all across the disk. Every single modification requires the disk head to perform a seek a random I.O. operation.
SPEAKER_01And seek time is the single greatest enemy of write throughput. I mean, if you're trying to ingest a million data points per second, and each point requires three or four random seeks to update the indexes and the actual data pages.
SPEAKER_00The whole system just grinds to a halt. It's physically impossible.
SPEAKER_01Even on modern SSDs, which don't have a mechanical seek time, this architecture is still grossly wasteful.
SPEAKER_00It is. And that's because of write amplification. To guarantee durability in those ACD properties, the RDBMS typically writes the data sequentially to a write-ahead log, the Huawei L, for crash recovery.
SPEAKER_01Okay, that's one write.
SPEAKER_00Right. And then it must write the modified pages back into the B-tree structure itself. That's a second write. And the amplification part comes in because if you modify one tiny data point,
SPEAKER_01say two bytes within a 16 kilobyte page.
SPEAKER_00The entire 16 kilobyte page must be rewritten back to disk. Even though only a few bytes changed, you just forced 16 kilobyte of I.O.
SPEAKER_01So for high frequency data where values are appended constantly, this creates this immense unnecessary I.O. load. It's effectively tripling or quadrupling the right cost compared to the raw data size.
SPEAKER_00and it gets worse. Finally, continuous high-volume insertion leads directly to fragmentation and page splitting. As these pages fill up, the B-tree has to split a single page into two new pages. Which I assume requires physically moving data around and rewriting index pointers. A massive ongoing I-O tax. It reduces your storage density, and it makes caching less efficient, which is absolutely detrimental when you're trying to manage petabytes of data.
SPEAKER_01So what we realize here is the philosophical difference, and this is the insight you need, Frederick. The relational model built on the B-tree, it prioritized the current state and transactional consistency. Right. If your bank balance changes from $100 to $50, the RDBMS must overwrite the old $100 value to maintain consistency. It enforces a destructive update model, deliberately losing the historical context. For high-frequency monitoring and compliance, you need the exact opposite. You need the complete immutable narrative of every single
pressure reading,
SPEAKER_01every temperature spike, and every event timestamp. And the B-tree was simply architecturally incapable of efficiently recording
SPEAKER_00immutable history at that kind of scale. That realization is what forced the invention of the TSTB.
SPEAKER_01So these severe limitations of the B-tree, the random I-O bottleneck, and the high write amplification, it forced engineers to look for an entirely new foundation for data storage. It did. And this led directly to the architectural divergence. abandoning update in place for the simple principle that all writes should be sequential, and that foundational principle is realized in the log-structured merge tree, or the LSM tree. An engine popularized by Google's Big Table paper and used in various forms by
SPEAKER_00modern giants like RoxDB, Cassandra, and, critically for our conversation, specialized TSDBs like InfluxDB. The core philosophical shift is this. If random writes are orders of magnitude slower than sequential writes, Let's just design a storage engine where all writes are sequential appends. That's it.
SPEAKER_01So let's walk through the LSM lifecycle step by step, because understanding this mechanism really explains the trade-offs of modern data performance.
SPEAKER_00Okay. First, data hits the memtable. This is a fast, highly optimized, mutable structure that lives in volatile memory, in RAM. And it's usually implemented as something called a skip list or a similar structure
SPEAKER_01that keeps the incoming data sorted by key and time.
SPEAKER_00Right. This is where that high ingestion speed originates. You're just writing to memory.
SPEAKER_01Okay, so what about durability? The D in acid. If the power goes out, you lose everything in RAM.
SPEAKER_00Good question. Second, and crucial for durability, the incoming data is simultaneously appended to the write-ahead log, W-A-L-L, on disk. This is a strictly sequential append-only operation.
SPEAKER_01So because the disk head is just moving forward in a straight line, it maximizes disk throughput and ensures crash recovery without performing any of those costly random seeks.
SPEAKER_00Exactly. Then third, when the meng table reaches a predefined size threshold, let's say 128 megabytes, it is frozen, moved off the hot ingestion path, and flushed to disk as an immutable file.
SPEAKER_01And this file is called a sorted string table, or an SS stable.
SPEAKER_00Right. And since the data was already sorted in memory, flushing it to disk is another massive sequential write operation. No random seeking, no page splitting, just dumping a large sorted file.
SPEAKER_01And this is the key architectural break from the B-tree. The B-tree writes in place randomly, paying that IO tax immediately.
SPEAKER_00Whereas the LSM tree writes sequentially, deferring the cost.
SPEAKER_01Deferring it to where? To the final step, compaction. Over time, you accumulate many of these small immutable SS stables on disk, Compaction is the background process that continuously merges these files, reorganizes them, and critically discards obsolete data-like older versions of a sensor tag or duplicate entries. So compassion is where the deferred cost of the LSM model is paid, but it's done asynchronously in the background.
SPEAKER_00Right, which mitigates the impact on your foreground ingestion speeds. This deliberate design leads directly to the crucial engineering choice for you,
SPEAKER_01Frederick, and that is the amplification metrics. The LSM model is a strategic choice to maximize right throughput at the expense of potential read performance. Let's quantify that tradeoff with right amplification WA and read amplification RA.
SPEAKER_00As we said, B-trees suffer from high write amplification because of the random I.O., the page splitting, and rewriting entire blocks for small changes. And LSM trees, because of that sequential flush, have lower immediate write amplification. They do, though compaction does add some deferred overhead. But for TSDBs ingesting millions of points per second, low WA is mandatory. It's not a choice.
SPEAKER_01The compromise comes on the read side. B-trees guarantee low read amplification because that tree structure lets the system seek directly to the single leaf node containing the definitive current data.
SPEAKER_00LSM trees, however, they exhibit higher read amplification. And the reason is when you query for a piece of data, say the last reported value for a temperature sensor, the system can't trust just one location.
SPEAKER_01Right. It has to check the mem table for the newest data. And potentially multiple overlapping as stables on disk to find the most recent
SPEAKER_00version of that key. So the read cost is directly proportional to how many files you have to check. The implication is that TSDBs accept this higher read amplification because they're
SPEAKER_01designed for analytical workloads, queries that aggregate millions of points over time rather than low latency transactional lookups.
SPEAKER_00But this reliance on compaction means if that background process lags, if you can't keep up with the incoming write volume, your read performance can degrade severely. The system is forced to check an ever-growing number of small disparate files.
SPEAKER_01This brings us to the fascinating details of compaction strategies, which is how specialized TSDBs actually tune the engine to manage this WA versus RA tradeoff for specific workloads.
SPEAKER_00The first main strategy is called leveled compaction. It's famously used by technologies like RoxDB and LevelDB. This is the aggressive read-optimized strategy.
SPEAKER_01Or does it work?
SPEAKER_00Data is organized into a rigid hierarchy of levels L0, L1, L2, and so on, and the files within any given level are guaranteed to have non-overlapping key ranges.
SPEAKER_01Ah, so the advantage here is that you minimize read amplification. A query knows it only has to check at most one file per level to find the relevant key range.
SPEAKER_00Exactly. It makes your read performance fast and consistent.
SPEAKER_01But what's the cost?
SPEAKER_00The cost is high write amplification. As new data cascades down the levels, a file might be read, merged, and rewritten many, many times before it reaches the final most optimized level.
SPEAKER_01So you're paying a high price in continuous I.O. just to guarantee the consistency of your read path.
SPEAKER_00You are. The second primary strategy is tiered compaction, or size tiered. This is favored by systems like Cassandra and ScyllaDB, and it's often ideal for pure write-heavy TSDBs.
SPEAKER_01And in this model? The system simply waits for a certain number of files of similar size to accumulate
SPEAKER_00in a tier before merging them all at once into a much larger file. The critical difference, I'm guessing, is that files can overlap in terms of their key ranges. That's the key. This overlapping is what makes it so efficient for writing. The advantage is extremely low. Write amplification. Data is usually only written once when it's flushed and then maybe once again when it's merged into a larger tier. Which is a massive win for write throughput and maximizing ingestion capacity for
SPEAKER_01your sensor data.
SPEAKER_00A huge win. However, the consequence is high read amplification. Because many large files can overlap, a query might have to check a dozen different files to locate the latest value.
SPEAKER_01And I read it also requires substantial temporary disk space overhead, maybe up to 50%, during the merge operation of these very large tiers.
SPEAKER_00That's right. So this is a strategic engineering decision, Frederick. Choosing leveled compaction means you prioritize fast, consistent query latency for complex analytical reporting. Whereas choosing tiered compaction means you prioritize sheer ingestion volume and
SPEAKER_01speed, making the system highly resilient against unexpected traffic spikes. And of course, modern systems like Datadog's Husky Engine, they use hybrid approaches.
SPEAKER_00They might use a tiered strategy for the vast, right-heavy historical archive, but implement mitigations like time-range pruning. So the system checks the minimum and maximum timestamps of a file before wasting the I.O.
SPEAKER_01to read the actual data.
SPEAKER_00Exactly. It reduces the read penalty inherent in that tiered model. The specialization is just relentless.
SPEAKER_01So the architectural solution, the LSM tree, it didn't just immediately create the modern cloud-native TSDBs we have today. It evolved out of a clear lineage of tools, each solving a specific problem related to scale or hardware. We start with what our sources call Generation Zero, the pioneers. Long before generalized big data, we had proprietary industrial systems called data historians emerging around the 1980s. And the prime example is the OSSoftPI system, which launched in 1985.
These systems were critical precursors focused on operational technology OT in
SPEAKER_01environments like oil and gas, manufacturing, and utilities.
SPEAKER_00Precisely where Sourceful Energy operates. They prioritize bulletproof reliability, highly specific compression, and tight integration with industrial control systems like SCADA and PLCs.
SPEAKER_01They were essential for process monitoring and regulatory compliance, but they had two major operational constraints.
SPEAKER_00immense cost and debilitating vendor lock-in. They were often proprietary software tied to specialized hardware silos. They just didn't scale into generalized IT infrastructure. The first open-source antidote to that came in the late 1990s with RRDTool.
SPEAKER_01That's the round-robin database tool. This was the fixed-size era, a very pragmatic solution to scarce storage.
SPEAKER_00RRDTool was built around the round-robin archive, or RRA, which is essentially a circular buffer. The key feature, the whole reason it was invented, was that the size of the database never grew. New data simply overwrote the oldest data in the buffer.
SPEAKER_01So to retain some sense of history, RRDTool would automatically aggregate or downsample the data as it aged.
SPEAKER_00Right. The high-resolution data from yesterday might be averaged into 10-minute blocks for the previous week and then into hourly blocks for the previous year.
SPEAKER_01But the limitation there is severe. If you needed to do detailed forensic analysis and tried to zoom in on a high resolution spike from six months ago.
SPEAKER_00The raw data was gone. It was already replaced by a lower resolution average. RRD tool was simple, great for basic monitoring alerts, but totally unable to scale for the kind of detailed historical or predictive analysis required today. This brings us to generation 1 and 2, scale and tags. The sheer volume of machine data from the late 2000s just broke that fixed-size model. We moved into the era of distributed systems, and OpenTSDB, released in 2010 by StumbleUpon, was the foundational step here.
It was the first system to leverage distributed storage by being built atop HBase,
SPEAKER_00which is the open-source implementation of Google's BigTable.
SPEAKER_01Its true innovation, though, was introducing tags, these key-value metadata pairs attached to metrics. Before that, you had these rigid hierarchical names like servers.useast.web.cpu.load. A real mouthful.
SPEAKER_00Yeah. OpenTSDB allowed you to simplify the metric name to just cpu.load and then attach tags like hostrev01 and dceast. This allowed for far more flexible querying and aggregation across infrastructure boundaries.
SPEAKER_01But the drawback was operational complexity. It required maintaining a full complex Hadoop and HBase cluster, which was a massive undertaking.
SPEAKER_00And that complexity drove the next wave of innovation.
SPEAKER_01Right. Then came InfluxDB in 2013. This was the first mainstream, purpose-built, open-source TSDB. It dropped all those external dependencies for native Go implementation, which dramatically simplified deployment.
SPEAKER_00And crucially, it built its own specialized LSM variant, the TSN, or Time Structured Merge Tree, which was highly optimized for time series data.
SPEAKER_01And then we have Prometheus, developed at SoundCloud around 2012, which really focused on observability and alerting. And its key architectural inversion was the pull model.
SPEAKER_00Or the scrape model.
SPEAKER_01Right. So instead of the traditional model where applications push metrics to the database, which risks the database being overwhelmed by a stampede of failing applications, the Prometheus server periodically initiates requests or scrapes metrics from designated HTTP endpoints. This inversion of control made the monitoring system inherently more stable and
SPEAKER_00more reliable because the monitoring server dictates the pace, not the monitored application.
SPEAKER_01Prometheus also introduced PromQL, a very powerful functional query language, and it focused heavily on highly optimized in-memory storage, leveraging the most advanced compression techniques possible.
SPEAKER_00And this brings us back to economic viability. For you, Frederick, storing petabytes of high-resolution sensor data is only possible because of these advanced time-series-specific compression techniques.
SPEAKER_01If they only achieved standard JZIP compression rates, the cloud bill would make the entire project uneconomical.
SPEAKER_00Completely. General-purpose compression techniques fail here because they don't leverage the inherent patterns in time series data. TSDGs use specialized algorithms, many of them derived from Facebook's guerrilla paper, that leverage predictability.
SPEAKER_01Let's look at delta of delta encoding for timestamps. In your energy monitoring system, Frederick, sensor beatings arrive at regular intervals, say, exactly every 10 seconds.
SPEAKER_00So the difference between consecutive timestamps is always 10. And the difference between those differences, the delta, the delta is zero. And storing a zero only requires a single bit of information compared to the 64
SPEAKER_01bits you'd typically need for a full raw timestamp. In stable streams, this achieves dramatic compression of the timestamp series itself.
SPEAKER_00Then you have XOR encoding for the values. Metric values like voltage or CPU temperature, they often change very slowly or predictably. The XOR algorithm calculates the difference between the current floating point value and the previous value.
SPEAKER_01So if the values are close, say, 30.00 to 30.01, the XOR result contains a lot of leading and trailing zeros, and the algorithm only stores that small, meaningful block of differing bits in the middle. The impact is astonishing. Combined, these techniques reduce the storage requirements from 16 bytes per sample down to an average of 1.3 bytes per sample. That's a 12x reduction.
SPEAKER_00The 12x reduction isn't just a technical footnote. It's the difference between a feasible, long-term historical archive and a system that hits the limit of your cloud budget in three months. It's what makes multi-year, high-resolution storage economically possible for large-scale sensor deployment. So as compression made storing the data feasible, the nature of data complexity scaled up. And this complexity, driven by the shift towards microservices as ephemeral infrastructure, introduced the most critical modern constraint, the high cardinality crisis.
SPEAKER_00Right. Cardinality is simply the number of unique combinations of tag values. In the OpenTSDB era, you might have had low cardinality, maybe region east combined with status active. Very predictable.
SPEAKER_01But in modern ephemeral systems, exactly what you use in dynamic energy grid monitoring, Frederick data is tagged with volatile IDs. Think about using a unique smart meter for every reading from a million devices,
SPEAKER_00or a unique container that lives for 30 seconds, or a unique user session id. If you use these ephemeral high-turn IDs as tags.
SPEAKER_01The index size just explodes.
SPEAKER_00It explodes. Early inverted index designs, where the index maps a tag value like containered kexize to a list of time series IDs, could easily exceed available RAM within days.
SPEAKER_01Which leads to out-of-memory errors, O errors, and catastrophic crashes. This crisis is a direct architectural consequence of the microservices trend. The database system had to change because your application deployment strategy changed. So the industry responded not with one single solution, but with three divergent architectural paths. all trying to shift the cost burden away from that index.
SPEAKER_00The first response was indexing optimization. Systems like VictoriaMetrics didn't abandon the index, but they focused on heavily compressing the index itself. They treated the index structure almost like a time series, allowing it to spill efficiently to disk without crashing the system when RAM was exhausted.
SPEAKER_01The second response was more radical. The columnar or scan based approach championed by databases like QuestDB and GreptimeDB. And they fundamentally changed the geometry of the data storage.
SPEAKER_00Instead of relying on a pre-built inverted index for every possible tag combination, they store data in columnar formats, where all values for a single column, say, all the temperature readings, are stored contiguously.
SPEAKER_01And they leverage technologies like Apache Arrow and Parquet for storage, and crucially, something called vectorized execution and SIMD instructions for querying.
SPEAKER_00Let's pause on SIMD. Single instruction, multiple data. This is highly pedagogical and really important. Okay. Instead of the CPU processing one data point at a time, like a standard row-based database, vectorized execution allows the CPU to process a chunk of data points, say, 16 or 32 integers simultaneously with a single instruction.
SPEAKER_01So by doing this, they can scan millions of rows per second very quickly, even without a perfect index.
SPEAKER_00They shift the cost. They shift it from write time, building that massive index that caused the OM errors, to read time when they're scanning the data. And that's an acceptable tradeoff for analytical queries where latency is measured in seconds, not milliseconds.
SPEAKER_01And the third response is hybrid partitioning, which is exemplified by timescale dB built on the solid foundation of post-Griscoll.
SPEAKER_00Right. They use what are called hypertables, and they partition the data primarily by time and secondarily by a spatial dimension like device ID or host ID.
SPEAKER_01It's a divide-and-conquer strategy.
SPEAKER_00Exactly. By constraining the standard B-tree indexes within smaller time-based chunks, they prevent the index from becoming a single monolithic structure that collapses under high cardinality. It solves the problem by simply creating thousands of small manageable relational indexes instead of one unmanageable giant one.
SPEAKER_01OK, so now let's move beyond just storing metrics to addressing the need for absolute auditability and truth, which is critical in regulated industries like energy. We're entering the realm of temporal and immutable systems.
SPEAKER_00Standard TSDBs usually only track what's called valid time, the time the event actually occurred in the real world when the sensor reading was taken.
SPEAKER_01But compliance and financial systems demand a second crucial dimension.
SPEAKER_00By temporal modeling, which introduces transaction time.
SPEAKER_01And this is vital for audit trails. So valid time is when the fact was true. For instance, a retroactive change to a power tariff effective January 1st.
SPEAKER_00But transaction time is when that fact was recorded in the database. Maybe the entry was officially made on February 15th.
SPEAKER_01So if you ask the system, what was the tariff rate on February 1st?
SPEAKER_00The answer differs depending on whether you query by valid time.
SPEAKER_01Which would give you the new tariff.
SPEAKER_00From transaction time. Which would give you the old tariff because the change hadn't been recorded yet. Bitemporal databases preserve the integrity of the data narrative against both
SPEAKER_01real-world retroactive changes and the system recording time. And the ultimate expression of this database as narrative model is event sourcing,
SPEAKER_00where the system stores only the immutable sequence of events. The log and the current state is just reconstructed by replaying that log.
SPEAKER_01But how do you ensure that the log itself hasn't been tampered with? This is where cryptographic ledgers come in, utilizing structures like Merkle trees or hash trees seen in systems like IMUD. This marries the high speed append only characteristics of the LSM tree with cryptographic verification. Let's detail the Merkle tree mechanism because it's brilliant in its simplicity and its power.
SPEAKER_00Every individual transaction, a sensor reading, a financial log entry is cryptographically hashed.
SPEAKER_01Okay. Those individual hashes are then paired up and the pair is hashed again. This process repeats hashing pairs of hashes until they all culminate in a single definitive value, the root hash. So if even one bit of a single historical record at the very bottom of the tree is tampered with, that hash changes. And that change immediately propagates all the way up through the pairings,
SPEAKER_00resulting in a completely different root hash.
SPEAKER_01So clients can request a consistency proof, the minimal set of hashes needed to recompute the root. And if the client's computed root hash matches the system's publicly published root
SPEAKER_00hash, the data is mathematically proven to be unaltered and permanent, even against administrator interference. For critical compliance data, this is the highest level of data integrity you can achieve. Finally, we have to address this complex real-world issue of metadata evolution.
SPEAKER_01In a pure TSDB, if a device changes name, say a wind turbine component goes from asset A to asset B after maintenance.
SPEAKER_00The time series history is disconnected. The tags define the unique series, so the device's history is now fragmented across two logical series IDs. The robust solution here is borrowed directly from data warehousing, slowly changing dimensions, or SCD type 2. This is a necessary architectural discipline when you're managing large, evolving fleets of assets like you are, Frederick.
SPEAKER_01So instead of tagging your metrics with mutable names like asset A, you tag them with an immutable ID like asset A5521. And this ID never changes. Then you maintain a separate, often relational metadata store that maps the immutable ID to its evolving descriptive metadata. For example, ACID ID 5521 corresponds to name. Turban alpha, which is valid from 2020 to 2022, and then name. Turban beta, valid from 2022 to the present. So when you query, you don't query the TSDB directly.
You query the relational metadata store first, and that query performs a query time join.
SPEAKER_01Think of it like this. If you ask, show me all the data for turbine alpha, even after it was renamed, the system first looks up all the time ranges associated with that name. It then joins those time ranges with the immutable ID and finally instructs the TSDB to pull data for a set ID 5521 only during the 20 to 2022 range. And this ensures the device's comprehensive history remains whole, regardless of how often its descriptive identity changes.
SPEAKER_00It's a complete picture. This journey has shown us that the time series database revolution wasn't merely a
SPEAKER_01performance enhancement. It was a fundamental architectural shift dictated by hardware and by data reality.
SPEAKER_00We moved from optimizing for scarce storage and reliable random access, that was the B-tree, to optimizing for high-velocity append-heavy writes, leveraging the fact that sequential writes are just vastly cheaper than random I.O. That's the LSM log. And this simple hardware reality fundamentally defined the software architecture of
SPEAKER_01the last decade. For you, Frederick, at Sourceful Energy, this evolution is not just historical context.
SPEAKER_00It is your competitive edge. Moving from proprietary, rigid historians to flexible, scalable, open-source TSDGs moves your operations from purely reactive alerting on a system failure to truly predictive. It allows for deep machine learning integration on those vast, well-compressed data sets. And the high cardinality challenge is your daily reality as you deploy thousands of ephemeral sensors and smart meters. The technical choices you make. For example, choosing a tiered compassion strategy for maximum ingestion
versus a leveled
SPEAKER_00strategy for low latency analytical queries. These are now core strategic decisions. They determine the performance characteristics of your entire grid monitoring system. They do. Here's a final provocative thought for you to ponder, building on everything we've discussed today. We noted that modern lake houses are attempting to unify these specialized systems, using columnar storage for analytics, LSM for ingestion, and transaction logs for time travel. Given the profound architectural divide we've explored between B-trees, which champion transactional consistency and immediate read speed,
SPEAKER_00and LSM trees, which prioritize maximum sequential write speed, can a truly unified database architecture ever exist without making unacceptable compromises in either critical consistency or ACID or high-velocity performance? Or will polyglot persistence using specialized tools like TSDBs for specialized jobs always be the necessary strategy to maintain the integrity and performance of the complex data narrative? The decision is yours to manage.
Coordinated with Fredrik, Episode 127. Forty-two minutes on how a company gets its price: what a multiple counts, why the same krona can be worth seven years in one company and twenty-seven in another, how a rise in...
Fifty minutes on two runs a day apart: the rest of Vancouver, and the road from ten Helium gateways to physics first. An interview with Lily. On Thursday I answered her questions in English; on Friday I went back to...
Thirty-seven minutes on two runs a day apart: the two years after the money came in, and home. An interview with Lily. I answered her questions in Swedish while running; the English voice you hear is my cloned voice...
Thirty-nine minutes on the two years before a term sheet arrived on my birthday, and what it took to turn it into money. An interview with Lily. I answered her questions in Swedish on a fifteen-kilometre run; the...
This episode started in a car. A clear October day, low sun, the drive from Kalmar to Stockholm. I could have flown, and it would have been faster. But the hours in the car are a different kind of time. The car keeps...