TimedValueHistory vs. TimedCharacteristicHistory


#1

Context for Question: TimedCharacteristicHistory Types seem to be very hard to access and aggregate across multiple ParentTypes. It seems to be a ‘catch-all’ for attributes that an application developer is not sure exactly how they will be used, but wants to maintain them in the database. I feel like TimedValueHistory is a more explicit way to store the information, and therefore ‘better’.

Question Part 1: When should I use TimedCharacteristicHistory vs. TimedValueHistory to keep track of an attribute and its historical values?

Question Part 2: Can TimedValueHistories be stored in Cassandra?


#2

TimedValue/TimedValueHistory are used to track a single value that changes over time (e.g. an account status). There is typically a field in the parent type that holds the latest entry for that value (e.g. latest account status) and the history has the changes over time for that status.

=TimedCharacteristicHistory, on the other hand is used to track multiple values that change over time in a single type. As a result, each entry has an additional name field instead of just the parent vand value fields present in TimedValue. This means that there is no latest value for the history/parent as there can be multiple entries with different names. This is why you never see a TimedCharacteristic field paired with the history as you do with TimedValue/TimedValueHistory.

As far as what to choose, every TimedValue/TimeValueHistory needs to be known when defining the type/schema as a separate field would be defined in the parent for the latest value and a separate type would be defined for the history entries. For cases where there are lots of characteristics or it is otherwise not feasible to bake in the individual characteristics to the schema, the TimedCharacteristicHistory should be used. Otherwise, there are the obvious advantages to TimedValue.

For the second part of the question, yes the histories can be stored in Cassandra. However since Cassandra doesn’t offer the same level of querying capabilities as relational, you will be more limited as to what type of fetching you can do.