Back
Glossary

Merge on Write

VeloDB Engineering Team· 2025/09/25

What is Merge on Write

Merge on Write (MoW) is one of the primary key model implementations in VeloDB, designed to optimize real-time analytics and low-latency query performance. Compared with Merge on Read (MoR), Merge on Write significantly improves query efficiency, making it ideal for workloads where fast query response time is critical.

How It Works

In Merge on Write mode, VeloDB handles primary key conflicts at the data ingestion stage:

  • When new rows with duplicate primary keys are inserted, VeloDB does not merge them immediately.
  • Instead, the system creates a Delete Bitmap that marks the old rows as deleted.
  • During query execution, VeloDB can directly skip rows flagged in the Delete Bitmap, eliminating the need for runtime deduplication.

This design makes queries lighter and faster, ensuring sub-second query latency even under heavy analytical workloads.

Key Differences

FeatureMerge on WriteMerge on Read
Query PerformanceVery high – queries skip invalid rows using Delete BitmapLower – requires runtime deduplication
Write PerformanceVery high – queries skip invalid rows using Delete BitmapStronger – no extra work at write time
Best FitRead-heavy, real-time analytics, low-latency dashboardsWrite-heavy, frequent data ingestion

Typical Use Cases

  • Real-time reporting systems requiring less than 1s query latency.
  • Web3 data analytics, combining on-chain and off-chain data.
  • User behavior analysis in e-commerce and gaming platforms.
  • Monitoring and alerting systems that demand instant query responses.

Summary

Merge on Write is a key optimization in VeloDB's primary key model, tailored for real-time analytics. By generating a Delete Bitmap at write time, VeloDB dramatically boosts query performance. Although ingestion is slightly slower compared to Merge on Read, MoW is the best choice for read-intensive analytical workloads where sub-second latency is a priority.