Advice needed on mysql / for loop

I need some advice how to handle the data in the best way

i get reservations from a xml, then i loop trough it with a for loop.
then on every step i use node.send to output the values.
these values i want to check with another local database and if they do not excist and want to add them.

but the output is really fast going :wink:

can i just forward this output to a script and then to a sql node?
is there a buffer for this?

Thanks

What do you mean by a script? If you mean nodes such as function nodes then you should be ok. The speed should not be an issue as each message will be handled before the next one gets processed. It will run at whatever speed your processor and database can handle. Node red is single threaded so it will handle them one after another.

Thanks Colin,

Yes i mean a function node.

So pretty cool!
You made my day :wink:

Have a nice weekend!

If trying to optimise speed. Don't forget that the insert logic in the db may become the slowest part. You may wish to consider trying to batch your inserts, so collect a load of inserts and send them to the db all at once.

you can also get the db to check to see if it exists and only add if it doesn’t

http://cc.davelozinski.com/sql/fastest-way-to-insert-new-records-where-one-doesnt-already-exist

1 Like

thanks TotallyInformation and ukmoose, the speed is not the problem for now.
i try the solution from ukmoose now