Like you’re five …
You have a toy car. I have some chocolate. We want to swap.
- If I give you my chocolate first you might not give me the car.
- If you give me the car first I might not give you the chocolate.
- If we exchange at the same time - a transaction - then we should be safe.
Databases can have the same problem - moving money between accounts, for example - so we use transactions to do the task completely or not at all.
Ignition has a historian. It usually saves data in a “narrow” column format.
# tagid, intvalue, floatvalue, stringvalue, datevalue, dataintegrity, t_stamp
'431', '24', NULL, NULL, NULL, '192', '1651361074677'
'11', NULL, 3.14159, NULL, NULL, '192', '1651361075007'
'109', NULL, NULL, "Mixing", NULL, '192', '16513610763321'
- The tag id (which can be used to look up the tag name in another table).
- The table can take integers, floats, strings and date types. These will be stored in the appropriate column.
- The dataintegrity stores the OPC quality of the data. 192 signifies valid data.
- The t_stamp is the milliseconds since 1970-01-01.
While this can be very useful it can sometimes be difficult to match up all the events that happened at a particular time because each record will have a (slightly) different timestamp. Transactions allow us to record in a “wide” format and to allow us to design the table to suit. For example:
# timeStamp, stopCause, speed, temperature, count
2022-05-01 22:07:07, 455, 7.3, 44.9, 2910
2022-05-01 22:24:07, 402, 17.7, 45.3, 3210
Now it’s very easy to retrieve all the records for that event.
The transaction manager makes it easy to record rows based on time intervals or events.