Define Data Freshness Before Choosing a Database
Guepard Team
13 novembre 2026
“We need real-time analytics” is not enough information to choose a database. It may mean that a user must see their own edit immediately, that fraud rules must observe an event within a second, or that an executive dashboard can lag by several minutes. Those requirements imply different consistency, cost, and failure behavior.
Before comparing engines, define freshness at the point where a person or service consumes the result. A fast database behind a delayed connector and a ten-minute cache still serves old information. Conversely, an inexpensive periodic load can be entirely adequate for a decision made once each morning.
Choose the clock that answers the question
Separate event time, source commit time, ingestion time, and visible time. Event time says when something happened in the business domain. Commit time says when the source durably accepted it. Ingestion time says when a downstream system received it. Visible time says when the serving path actually returned it.
For operational propagation, measure visible time minus source commit time. For a delayed mobile upload, the difference between event time and visible time includes time the server never controlled. Both are useful, but labeling both “database lag” makes diagnosis and ownership difficult.
Use synchronized clocks and document uncertainty when subtracting timestamps from different machines. Where possible, pair time measurements with monotonically ordered source positions and synthetic end-to-end probes. Do not treat a timestamp inside an arbitrary application payload as a trustworthy commit timestamp.
Write a decision-specific objective
An illustrative objective for an operations screen might be: “99% of committed shipment updates are visible through the screen's read API within 20 seconds over a rolling seven-day window; no active shipment may remain unrefreshed for more than two minutes without a visible warning.”
The second clause matters. A global percentile can conceal one stuck tenant or partition. State the unit of measurement, observation window, population, and behavior during maintenance. Decide whether every update must be observable or only the latest state per entity. A coalescing cache may legitimately skip intermediate states but fail an audit-event requirement.
For a financial close, completeness can matter more than speed. Define a watermark that means all expected source partitions are processed through a boundary, rather than displaying the largest timestamp seen anywhere. One fast partition must not make an incomplete result look current.
Allocate the budget across the entire path
Suppose the illustrative 20-second objective reserves three seconds for capture, five for transport and transformations, four for sink application, five for caching, and three for serving and uncertainty. These are design allowances, not measured performance claims.
Instrument each transition with a correlation identifier and relevant source position. Validate the full path by committing a synthetic marker and querying the actual serving API until the marker appears. A direct SQL query bypasses caches and cannot establish the user's freshness experience.
Database-native lag metrics still help diagnose bottlenecks. PostgreSQL explains that replication lag fields describe recent write, flush, and replay delays; they are not predictions of catch-up duration and may become null on a caught-up idle system. An alert must understand those semantics rather than interpreting null as proof of either health or failure. PostgreSQL replication statistics
Compare failure behavior, not just the happy path
Run the same workload against candidate designs. Include steady traffic, bursts, large transactions, cold caches, a paused consumer, and a slow partition. Measure commit-to-visible delay by percentile and by partition. Record backlog growth and time to return within the objective after an interruption.
Track whether recovery competes with normal reads. A design that catches up quickly only by making the serving API unusable has traded freshness for availability. Measure both dimensions in the same test, using a documented dataset and resource budget.
Read-your-writes is a separate requirement. If a user saves an address and immediately reads from an asynchronous replica, a general twenty-second objective may be unacceptable. Options include routing that user's next read to the writer or waiting for the relevant source position to become visible, with a timeout and fallback. The exact mechanism depends on the database and topology; do not assume a dashboard freshness promise provides session consistency.
Decide what stale means to the application
A recommendation widget might serve stale content with no interruption. An inventory decision might need to consult an authoritative path. A report can show its last complete watermark and disable export while completeness is uncertain. Choose the behavior with the team responsible for the decision, not only the database team.
Only then compare database capabilities and operating costs. The right selection is the least complex architecture that meets the measured visibility, completeness, and failure requirements. Freshness is an end-to-end promise. An engine is one contributor to keeping it.
Guepard Team
Guepard Engineering