Whats the “best” way to store data?
My data comes in via mqtt and looks like this:
Gateway/devices/1/Voltage_of_L1_to_N
with Payload: {
“value”: 230.29,
“unit”: “Volt”,
“timestamp”: “2025-08-28T14:48:55+0200”
}
At the Moment “Voltage_of_L1_to_N becomes the measurement
“1” in the topic becomes a tag device=1
unit in payload becomes also a tag unit=Volt
and timestamp is timestamp.
The data comes with different timestamp. for example Voltage_of_L2_N comes in sometimes 1 oder 2 seconds later.
Should is using here one measuremtn with mulitpel fields? But the Problem I see is that the timestamps are different…
Is there a way to do better?
suyash
August 28, 2025, 4:49pm
2
Yes, one measurement with multiple numeric fields, metadata in tags is fine. Use tags for metadata (gateway, device, phase), and fields for numeric values (voltages). Also refer to this guide - InfluxDB schema design recommendations and best practices | InfluxDB 3 Core Documentation
Currently im only using one field per measurement. Whats the point using more than one field if your data have different timestamps?
Measurement of Voltage of L1, L2,L3 does never come in at the same time. So why using more than one field per measurement? Whats the benefit?
suyash
September 3, 2025, 1:56pm
4
You can setup one measurement with multiple fields to keep queries simple and performant and avoid “embedding” attributes in names. If values arrive at different times, you can still upsert the same row by using the same tagset and timestamp when you want them aligned.