Combine several messages from MQTT into one request to DataBase

What you need to consider - regardless of using node context, flow context, join nodes etc is...

If you gather all the values into one object, when do you write it to DB?

I can guarantee you all 50 items will not update at the same time so you will be writing necessary/unchanged values to the DB in a wide table.

Wouldn't it be better to generate a long table vs wide table?

e.g...

timestamp topic value
123456789 topic1 77.3
123456789 topic2 73.2
123456792 topic7 2.76
123456792 topic4 7.01

this would negate the need to gather all values into an object & any future data will fit without modification to the database.

1 Like