Transaction groups delete records older than

Try running DELETE FROM statustest WHERE t_stamp <= .... in the query browser.

Like that?

it is WORK!
How this script work everytime?

Do you mean that you manually deleted the records? But the automatic deletion is still not working?

Yes

From another thread, the deletion is a separate task from the group:

That said, is there anything in the log?

1 Like

I have that.


I don`t see that anything deleting rows in DB.

It is not working for me. Can you help me with it?

This sound like something for IA support to help with, as I cannot replicate it. Pinging @PGriffith.

As a workaround, you have a couple of options.

  • A gateway timer script that deletes the older rows.
  • A second transaction group that deletes the rows directly without using the ‘Delete records’ feature.

As an aside, also let us know what specific version of Ignition you are using.

Ignition 8.0.16.
I create some code, which delete these rows but i don`t know where i should write code.
code in MySQL, but i think that must do Ignition.
SELECT * FROM test.statustest;
delete from test.statustest where t_stamp<=DATE_SUB(NOW(), INTERVAL 11 DAY);
SELECT * FROM test.statustest;

query = "DELETE from test.statustest WHERE t_stamp<=DATE_SUB(NOW(), INTERVAL 11 DAY)"
system.db.runQuery(query, 'dbConnection')

Some references:
https://docs.inductiveautomation.com/display/DOC80/Gateway+Event+Scripts
https://docs.inductiveautomation.com/display/DOC80/system.db.runQuery

these references you send me for self-development?
If i have MySQL80 database, what you can see on pictures. then i should replace dbConnection on MySQL80?

please, can you see previous my message

Give a man a fish, and you feed him for a day; show him how to catch fish, and you feed him for a lifetime. :slight_smile:

That is correct. See? You’re already learning to fish.

1 Like

thanks, but it doesn t work. I don t know why. I checked all variant which I can think up.

Maybe firstly i should call to this DB an then use command for delete some rows?

How are you trying to use this?


query = “DELETE Select * FROM hourlystatistic WHERE t_stamp<=DATE_SUB(NOW(), INTERVAL 2 HOUR)”
system.db.run(query, ‘MySQL80’)
system.db.run(“DELETE Select * FROM hourlystatistic WHERE t_stamp<=DATE_SUB(NOW(), INTERVAL 2 HOUR)”, ‘MySQL80’)

try system.db.runQuery()

query = "DELETE Select * FROM hourlystatistic WHERE t_stamp<=DATE_SUB(NOW(), INTERVAL 2 HOUR)"
system.db.runQuery(query, 'MySQL80')
1 Like

this code not work…
in this window, this code is working