# Transaction execution delay

**URL:** <https://forum.inductiveautomation.com/t/transaction-execution-delay/103718>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [March 14, 2025, 5:24pm UTC](https://forum.inductiveautomation.com/t/transaction-execution-delay/103718 "2025-03-14T17:24:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![EMMANUEL\_TELLEZ](https://avatars.discourse-cdn.com/v4/letter/e/97f17d/32.png) [@EMMANUEL\_TELLEZ](https://forum.inductiveautomation.com/u/EMMANUEL_TELLEZ)\
**Post date:** [March 14, 2025, 5:24pm UTC](https://forum.inductiveautomation.com/t/transaction-execution-delay/103718/1 "2025-03-14T17:24:33Z")

</div>

Hello.

I would like to receive some guiding in how enhance my application. I am collecting data from different PLCs, I am using regular transaction groups for logging data in a SQL server, I use integer tag as a trigger and I save the timestamp when the trigger was set to "1". I am checking my DB and I noticed there is a huge difference between the trigger change its value and when the data arrives.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/a/7a873c98c6425abaa69c42e5a4a967d0ed1f069a.png)

This is the configuration for the transaction group I am using

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/2/d211a4ca0af155cdf5e7213ea3d3a4cf93e21c73.png)

Trigger change is managed by a gateway Script executed every second, in the DB omq\_createdateGroup corresponds to the time when the trigger is ON and omq\_createdate is a column with default query for getting current timestamp.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/0/90878e7bc5cb19e4de1294bbf3d0e8e677608331.png)

What do you recommend me to change? I understand a delay of 1 or 2 seconds is expected due to Gateway Script delay execution but more time seems something is wrong.

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [March 14, 2025, 5:26pm UTC](https://forum.inductiveautomation.com/t/transaction-execution-delay/103718/2 "2025-03-14T17:26:41Z")

</div>

Post code, not pictures of code. It helps to speed up responses by letting people copy and paste instead of reading and typing. Please see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831).

You can edit your post by clicking the pencil icon in the bottom right.

If you are triggering the transaction from a gateway script, you might as well just do the sql insert from that script, it will be faster and the entire transaction control and process will be in one place. You can define a named query and call it from that script. Or assemble the query on the fly and use `system.db.runPrepUpdate`

Additionally, I'm pretty sure you can consolidate a lot of your tag writes into fewer calls to [`system.tag.writeBlocking`](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-tag/system-tag-writeBlocking). It accepts a list of tags and list of values.

---

<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:** [March 14, 2025, 5:30pm UTC](https://forum.inductiveautomation.com/t/transaction-execution-delay/103718/3 "2025-03-14T17:30:23Z")

</div>

Do you have store and forward enabled on these transaction groups? If you do, the success/failure handshake only means that the "store" succeeded, not that the record has actually been delivered to the DB by the "forward" operation.

If you have complex trigger/handshake requirements, I strongly recommend you **not** use transaction groups at all, but script all of your operations. Also, when writing scripts, be sure to merge tag reads into as few `system.tag.readBlocking()` calls as possible, and merge OPC reads into as few `system.opc.readValues()` as possible. Similar for writes.
