# Transaction groups delete records older than

**URL:** <https://forum.inductiveautomation.com/t/transaction-groups-delete-records-older-than/42521>\
**Category:** Ignition\
**Tags:** ignition79, ignition80, database, vision, scripting\
**Created:** [January 22, 2021, 2:00pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-delete-records-older-than/42521 "2021-01-22T14:00:09Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrii.Randiuk](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@Andrii.Randiuk](https://forum.inductiveautomation.com/u/Andrii.Randiuk)\
**Post date:** [January 22, 2021, 2:00pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-delete-records-older-than/42521/1 "2021-01-22T14:00:09Z")

</div>

How can this be configured? Because I can’t find any example anywhere! The database I am using is MYSQL!

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/f/6f8b383decf15234bc8b75d4d03644de13f08ed2.png)

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [January 22, 2021, 2:09pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-delete-records-older-than/42521/2 "2021-01-22T14:09:24Z")

</div>

Because you have tagged your question with “scripting”, does this mean you are looking to understand how to configure that option via a script?

---

<div class="post-metadata">

**Author:** ![Andrii.Randiuk](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@Andrii.Randiuk](https://forum.inductiveautomation.com/u/Andrii.Randiuk)\
**Post date:** [January 22, 2021, 2:17pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-delete-records-older-than/42521/3 "2021-01-22T14:17:49Z")

</div>

I just want to understand how to configure this feature. Like where you need to click, so that it works. Because it writes to the database but does not delete or overwrite!

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [January 22, 2021, 2:23pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-delete-records-older-than/42521/4 "2021-01-22T14:23:34Z")

</div>

Why do you think that it is not working? I was testing this feature out recently and it did delete older records. However it does not perform a delete action all the time. The delete runs at some unspecified rate (but related to the rate that you are inserting), so that at any point in time you can have records older than 1 minute in your table.

See this question [Delete records older than (Transaction Groups) - How does this work?](http://forum.inductiveautomation.com/t/delete-records-older-than-transaction-groups-how-does-this-work/36532)

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [January 22, 2021, 2:26pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-delete-records-older-than/42521/5 "2021-01-22T14:26:42Z")

</div>

Stupid question. Your update mode is DB =\> OPC.

> - DB to OPC - Only read from the database and write to the OPC Server.

Should that be "OPC =\> DB" instead?

> - OPC to DB - Only read from the OPC server and write to the database.

---

<div class="post-metadata">

**Author:** ![Andrii.Randiuk](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@Andrii.Randiuk](https://forum.inductiveautomation.com/u/Andrii.Randiuk)\
**Post date:** [January 22, 2021, 2:33pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-delete-records-older-than/42521/6 "2021-01-22T14:33:56Z")

</div>

> [@peter](#):
>
> older than 1 minute in your table.

Yes, my mode OPC to DB, but anyways, it is not deleting anything.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/0/30d53e26ef349eb9b7da57be93912d39beadb84b.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/e/9e74ad941e4655291d6fde86c247682dbb88da96.png)

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [January 22, 2021, 2:40pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-delete-records-older-than/42521/7 "2021-01-22T14:40:06Z")

</div>

With the deleting set to “older than 1 minute” I have seen my tables grow to contain 2 minutes worth of data before the deleting occurs. And then it deletes back down to 1 minutes worth of data. The screen you show only has 1 minute and 40 seconds worth of data in it

---

<div class="post-metadata">

**Author:** ![Andrii.Randiuk](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@Andrii.Randiuk](https://forum.inductiveautomation.com/u/Andrii.Randiuk)\
**Post date:** [January 22, 2021, 2:42pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-delete-records-older-than/42521/8 "2021-01-22T14:42:35Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/1/c14ad4c8e913118d2c0fd6964840ff0b102a201d.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 22, 2021, 2:43pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-delete-records-older-than/42521/9 "2021-01-22T14:43:18Z")

</div>

Are you sure your DB connection has delete privileges? Can you run DELETE from the query browser?

---

<div class="post-metadata">

**Author:** ![Andrii.Randiuk](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@Andrii.Randiuk](https://forum.inductiveautomation.com/u/Andrii.Randiuk)\
**Post date:** [January 22, 2021, 2:46pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-delete-records-older-than/42521/10 "2021-01-22T14:46:44Z")

</div>

How i can check it?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 22, 2021, 2:48pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-delete-records-older-than/42521/11 "2021-01-22T14:48:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Andrii.Randiuk](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@Andrii.Randiuk](https://forum.inductiveautomation.com/u/Andrii.Randiuk)\
**Post date:** [January 22, 2021, 2:54pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-delete-records-older-than/42521/12 "2021-01-22T14:54:29Z")

</div>

> [@pturmel](#):
>
> `DELETE FROM statustest WHERE t_stamp <= `

Like that?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/3/8371262639310cbd8db7c14acaa893096dcafb37.png)

---

<div class="post-metadata">

**Author:** ![Andrii.Randiuk](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@Andrii.Randiuk](https://forum.inductiveautomation.com/u/Andrii.Randiuk)\
**Post date:** [January 22, 2021, 3:01pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-delete-records-older-than/42521/13 "2021-01-22T15:01:14Z")

</div>

it is WORK!  
How this script work everytime?

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [January 22, 2021, 3:23pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-delete-records-older-than/42521/14 "2021-01-22T15:23:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Andrii.Randiuk](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@Andrii.Randiuk](https://forum.inductiveautomation.com/u/Andrii.Randiuk)\
**Post date:** [January 22, 2021, 3:25pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-delete-records-older-than/42521/15 "2021-01-22T15:25:07Z")

</div>

Yes

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [January 22, 2021, 3:58pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-delete-records-older-than/42521/16 "2021-01-22T15:58:45Z")

</div>

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

> [@Delete records older than (Transaction Groups) - How does this work?](http://forum.inductiveautomation.com/t/delete-records-older-than-transaction-groups-how-does-this-work/36532/3):
>
> A vendor once told me this: Es. for “Delete Records older than” X : X \< 1 hour, the delete task execute every minute 1 hour\< X \<12 hours, every 15 minutes X \> 12 hours, every hour Of course in addition to @PGriffith’s answer wink

That said, is there anything in the log?

---

<div class="post-metadata">

**Author:** ![Andrii.Randiuk](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@Andrii.Randiuk](https://forum.inductiveautomation.com/u/Andrii.Randiuk)\
**Post date:** [January 25, 2021, 12:28pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-delete-records-older-than/42521/17 "2021-01-25T12:28:20Z")

</div>

I have that.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/4/745a86b33122299bd53dc31edba9c8a4f3bf1c05.png)  
I don`t see that anything deleting rows in DB.

---

<div class="post-metadata">

**Author:** ![Andrii.Randiuk](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@Andrii.Randiuk](https://forum.inductiveautomation.com/u/Andrii.Randiuk)\
**Post date:** [January 28, 2021, 11:10am UTC](https://forum.inductiveautomation.com/t/transaction-groups-delete-records-older-than/42521/18 "2021-01-28T11:10:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [January 28, 2021, 11:19am UTC](https://forum.inductiveautomation.com/t/transaction-groups-delete-records-older-than/42521/19 "2021-01-28T11:19:11Z")

</div>

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

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.

---

<div class="post-metadata">

**Author:** ![Andrii.Randiuk](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@Andrii.Randiuk](https://forum.inductiveautomation.com/u/Andrii.Randiuk)\
**Post date:** [January 28, 2021, 11:22am UTC](https://forum.inductiveautomation.com/t/transaction-groups-delete-records-older-than/42521/21 "2021-01-28T11:22:12Z")

</div>

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;

[Next page](https://forum.inductiveautomation.com/t/transaction-groups-delete-records-older-than/42521.md?page=2)
