# Hybrid Store Design Pattern

The *Hybrid Store* is a design pattern for merging batch and real-time data sources into a single dataset. It is an abstraction composed of several *versioned datasets*, along with a *current version* pointer (or symlink) serving one of them.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1746459861384/37af18f2-2125-43fa-950e-f1119b0c3fa4.png align="center")

The batch data source is a job that produces *new versions* of the dataset. The real-time data source, on the other hand, appends data to a *real-time buffer*, and this data eventually gets written to *all versions* of the dataset.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1746370540453/4f263134-53a1-4d67-851a-95ab0d64217f.png align="center")

When the batch data source runs and produces a new version of the dataset, the Hybrid Store design pattern then does the following:

* Create a new version N+1 of the dataset (called a *future version*) and load the batch data into it.
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1746370554339/3b0c47ea-79f7-4c64-9330-0e00b11e734b.png align="center")

* Replay recent data from the real-time buffer onto the future version N+1.
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1746370565179/dd811571-32c9-4bd3-81df-5932e604ac13.png align="center")

* After the buffer replay is caught up, switch the current version pointer from N to N+1. Version N can be kept as a backup. There is no future version anymore (until the next batch job).
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1746370648004/3e481863-d626-4135-a2e9-b52c4bc7fb6c.png align="center")

Hybrid Stores are a way to implement [Lambda Architectures](https://en.wikipedia.org/wiki/Lambda_architecture), but by merging at write-time, rather than read-time. They can also support [Kappa Architectures](https://www.oreilly.com/radar/questioning-the-lambda-architecture/).

[Venice](http://venicedb.org) is an open source database implementing the Hybrid Store design pattern, and other proprietary systems do so as well.
