✳simplemagic / data
Developers/Pulse
On this page

Timestamps, tags, and row identity

A measurement is a table of timestamped points. Each point carries string tags and typed fields. Model identity before loading production data: retry behavior and correction semantics depend on it.

Anatomy of a point

temperature,device=dev-001,region=us-east value=21.5,healthy=true 1791504000000000000
Part Example Contract
Measurement temperature Table name
Tags device=dev-001 String dimensions
Fields value=21.5 At least one typed value
Timestamp 1791504000000000000 Signed 64-bit Unix nanoseconds

Field types remain fixed for a measurement after the first successful write. New columns are allowed within the configured limit. A name cannot be both a tag and a field. Missing historical columns appear as NULL in SQL.

Append mode

Tables append by default. Identical timestamps do not imply identical rows: every accepted point is retained. This works for event streams where duplicates are meaningful or resolved in the application.

Retrying an append write can create a second logical event. WAL replay itself does not duplicate rows; application retries and recovery replay are different operations.

Deduplication mode

The sample configuration declares:

[tables.temperature]
mode = "dedup"
keys = ["timestamp", "device"]

Every configured key must be present. Equal key tuples identify one logical row. The latest WAL batch wins; within a batch, the latest input line wins. Event time does not order corrections. Tag order in the input has no effect on identity.

Replacement is not a patch

Writing a new value for the same key replaces the whole row. Omitted non-key fields become absent or NULL, rather than retaining their old values. Schema type history still applies.

For example, a correction containing only value removes the earlier humidity field from that row. Send the complete intended record when correcting a point.

Late arrivals and retries

Out-of-order timestamps are valid. An old retry can overwrite a newer correction to the same key. Deduplication is not request-ID deduplication and does not provide exactly-once delivery.

Send explicit timestamps when stable identity matters. If a timestamp is omitted, the receiving node supplies its wall clock once per request; a retry can receive a different timestamp.

Persisted policy

Standalone policies are stored with the data directory. Reopening existing data with a different policy map fails. Do not edit a policy and assume it will migrate stored data; plan a separate migration.

Search documentation

Type to search across both databases.

↑ ↓ to navigate · Enter to openEsc to close