# SQL tag update very slow

**URL:** <https://forum.inductiveautomation.com/t/sql-tag-update-very-slow/34476>\
**Category:** Ignition\
**Tags:** ignition80, database\
**Created:** [May 6, 2020, 6:59am UTC](https://forum.inductiveautomation.com/t/sql-tag-update-very-slow/34476 "2020-05-06T06:59:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![yifeiliu08](https://avatars.discourse-cdn.com/v4/letter/y/bbe5ce/32.png) [@yifeiliu08](https://forum.inductiveautomation.com/u/yifeiliu08)\
**Post date:** [May 6, 2020, 6:59am UTC](https://forum.inductiveautomation.com/t/sql-tag-update-very-slow/34476/1 "2020-05-06T06:59:52Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/b/beadce630916827d0bed1436b8f3321cea5e0ca1.png)  
i have a table that have 1 line, this top1 line will refresh every second by another software  
in SQL server side, if i execute select the update query it will response very quickly

But in the ignition side , i found the update is very slow, sometimes 1 minutes, sometimes 3 minutes.  
my setting update rate is 1s

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/a/a3a7ef331e2a5e19b2b6d90a8e2238e56903632a.png)  
i found not only this tag, but also other SQL tag have the same issue  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/c/c40133eb1d3e5405af022f4555e347cf10fb9661.png)  
i check the scada server task manager, seems the sql server memory and Cpu is very high.  
i don’t know what block the query update,here is the ignition server status  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/9/98aee5fffd5db9c5b8930a83cbc96e20126e5cc1.png)

---

<div class="post-metadata">

**Author:** ![kgamble](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kgamble/32/8019_2.png) [@kgamble](https://forum.inductiveautomation.com/u/kgamble)\
**Post date:** [May 6, 2020, 12:50pm UTC](https://forum.inductiveautomation.com/t/sql-tag-update-very-slow/34476/2 "2020-05-06T12:50:46Z")

</div>

In the gateway if you navigate to Status \> Databases \> Connections \> and then Details for the current database

Do you see any entries of long running queries and how long it is taking them to execute? I know its a small table, but if for some reason the queries are taking a while to respond to Ignition, you may see that they are bottle-necking. The “Other software” and Ignition may be fighting to get access to the table at the same time and Ignition losing the battle.

---

<div class="post-metadata">

**Author:** ![yifeiliu08](https://avatars.discourse-cdn.com/v4/letter/y/bbe5ce/32.png) [@yifeiliu08](https://forum.inductiveautomation.com/u/yifeiliu08)\
**Post date:** [May 6, 2020, 1:44pm UTC](https://forum.inductiveautomation.com/t/sql-tag-update-very-slow/34476/3 "2020-05-06T13:44:16Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/0/07e30370f1bb987ef6d89c2fac4f44cd99c36eb8.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/d/de3044bbaab6e64fce023f0ed9cb09f531c35c4b.png)  
seems there are many query are carry out  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/3/37bbf3f77b76ad5218c67aa53ce30da6061a859c.png)  
i have defined many tags in the tag tree, i have define them scaning speed is 240s  
but i can’t understand why they are still query very quick if i observe at the screen Status\>Databases\>Connections

---

<div class="post-metadata">

**Author:** ![Sanderd17](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sanderd17/32/8735_2.png) [@Sanderd17](https://forum.inductiveautomation.com/u/Sanderd17)\
**Post date:** [May 6, 2020, 1:53pm UTC](https://forum.inductiveautomation.com/t/sql-tag-update-very-slow/34476/4 "2020-05-06T13:53:08Z")

</div>

> [@yifeiliu08](#):
>
> scaning speed is 240s

You're sure it's 240 seconds? The time unit for tag groups is in milliseconds (ms).

You should also try the query in the SQL Management Studio. There you can see how long it takes, and you can even check the execution plan and take a look at what indexes are used.

---

<div class="post-metadata">

**Author:** ![yifeiliu08](https://avatars.discourse-cdn.com/v4/letter/y/bbe5ce/32.png) [@yifeiliu08](https://forum.inductiveautomation.com/u/yifeiliu08)\
**Post date:** [May 6, 2020, 2:29pm UTC](https://forum.inductiveautomation.com/t/sql-tag-update-very-slow/34476/5 "2020-05-06T14:29:21Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/a/ac392444a56e35c1af13f57c06a4d2985597c210.png)  
i found a very big query, i have already disable that tag, but still not stop this query , perhaps in some other place have a query i not found

---

<div class="post-metadata">

**Author:** ![Sanderd17](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sanderd17/32/8735_2.png) [@Sanderd17](https://forum.inductiveautomation.com/u/Sanderd17)\
**Post date:** [May 6, 2020, 2:34pm UTC](https://forum.inductiveautomation.com/t/sql-tag-update-very-slow/34476/6 "2020-05-06T14:34:45Z")

</div>

Yes, you should search what is calling that query.

I see you have a very high “plan count” too. This happens when you don’t use JDBC variable replacements (the ?-signs, or variables in names queries), but rather use text replacements (like expressions in the query).

However, you can force parametrisation on the SQL server with this command. It should make all your recurring queries a bit faster:

```auto
ALTER DATABASE CURRENT SET PARAMETERIZATION FORCED

```

And for that query with just 6 executions, but a high CPU time, you’d best check the execution plan.

---

<div class="post-metadata">

**Author:** ![yifeiliu08](https://avatars.discourse-cdn.com/v4/letter/y/bbe5ce/32.png) [@yifeiliu08](https://forum.inductiveautomation.com/u/yifeiliu08)\
**Post date:** [May 6, 2020, 3:02pm UTC](https://forum.inductiveautomation.com/t/sql-tag-update-very-slow/34476/7 "2020-05-06T15:02:01Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/e/e4b9a57197c455de7fbdd0e705dd6ff0009db336.png)  
after i force at the sql server side  
the plan Count number between 0-6

and the other query tag update speed is normal.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/e/e533d6f56a1873bf30847b763b9c9f8aa73ba84a.png)  
when i check the execution plan,here is the picture, still have some force solution?  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/6/6502a1daaa17aff180e2cf1dc9a13991c54a0968.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/e/e9866d8cd5e3353813dcede30abe9e3936e1c730.png)
