Basic advices on database layout

Hello,

I would like to store different metrics like temperature, pression or humidity. They are all supposed to be stored in the same bucket.

I have some difficulties to understand the differences in terms of performance/layout/good practices between having multiple measurement for each metrics such as

temperature value=X timestamp
humidity value=Y timestamp
pression value=Z timestamp

And having only one metric but multiple fields

meteo temperature=X,humidity=Y,pression=Z timestamp

What are the consequences of each choice, and what is the best choice?

Thank you in advance,
Bill

Hello @billdangerous,
Tags and measurements are indexed, fields are not.
If minimizing query response time is a priority then you could separate out the fields in separate measurements or tags depending to fit common queries you’d be executing.
If easily visualizing all data together is a priority or performing math across data is important than you might want to consider keeping it all in one measurement. Of course you can perform math across measurements but you would have to execute a join first.

The following blogs might be helpful to you:

1 Like

Thank you for this clear answer.

1 Like

@billdangerous of course! Thank you for your patience.