pretty new to influxdb. I try to understand if there is any advantage/disadvantage of writing 2 lines with the same tags over one line with 2 fields.
measurement, tag1=v1, tag2=v1 field1=value1 ts
measurement, tag1=v1, tag2=v1 field2=value2 ts
measurement, tag1=v1, tag2=v1 field1=value1,field2=value2 ts
I’m using java client to write the data.
@gikeren I think the greatest advantage writing multiple fields in a single line provides is just keeping the size of the request smaller. When you multiply the addition of multiple lines for the same timestamp over thousands or tens of thousands of rows, that can quickly add up.
For example, with the line protocol you provided:
measurement,tag1=v1,tag2=v1 field1="value1" 1663782719
measurement,tag1=v1,tag2=v1 field2="value2" 1663782719
measurement,tag1=v1,tag2=v1 field1="value1",field2="value2" 1663782719
Same data written, but the payload of the write request will be much smaller. Best practice would be to write multiple fields with the same timestamp and tag set in the same line.
@scott Thank you very much for the detailed answer. The size aspect sounds reasonable. Thanks.