# \[SOLVED\] What is the best way to run a script after a database table has been updated?

**URL:** <https://forum.inductiveautomation.com/t/solved-what-is-the-best-way-to-run-a-script-after-a-database-table-has-been-updated/32987>\
**Category:** Ignition\
**Created:** [March 10, 2020, 7:28pm UTC](https://forum.inductiveautomation.com/t/solved-what-is-the-best-way-to-run-a-script-after-a-database-table-has-been-updated/32987 "2020-03-10T19:28:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [March 10, 2020, 7:28pm UTC](https://forum.inductiveautomation.com/t/solved-what-is-the-best-way-to-run-a-script-after-a-database-table-has-been-updated/32987/1 "2020-03-10T19:28:09Z")

</div>

I have a database table as follows:

```
TableName
RFID1 (varchar)
RFID2 (varchar)
UniquePK (bigint)

```

Every once in a while this database table will get a new row added to it and that row will always have the largest UniquePK at that time. In Ignition how do I trigger this event happening reliably?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [March 10, 2020, 7:35pm UTC](https://forum.inductiveautomation.com/t/solved-what-is-the-best-way-to-run-a-script-after-a-database-table-has-been-updated/32987/2 "2020-03-10T19:35:11Z")

</div>

I’m not sure you can get notified on demand by the database but maybe you can use a DB tag that uses `MAX()` on the `UniquePK` column and then a tag change script on the DB tag.

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [March 10, 2020, 7:53pm UTC](https://forum.inductiveautomation.com/t/solved-what-is-the-best-way-to-run-a-script-after-a-database-table-has-been-updated/32987/3 "2020-03-10T19:53:43Z")

</div>

I think I understand what needs done. How often can I expect Ignition to check if something in my table has changed? 1 second? 5 seconds? 30 seconds?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 10, 2020, 8:31pm UTC](https://forum.inductiveautomation.com/t/solved-what-is-the-best-way-to-run-a-script-after-a-database-table-has-been-updated/32987/4 "2020-03-10T20:31:39Z")

</div>

If you’re using a DB tag, as often as you want. Make a scan class (\<=7.9) or tag group (\>=8.0) at whatever polling rate you want.
