# Ignition multiple query tag- performance of syatem

**URL:** <https://forum.inductiveautomation.com/t/ignition-multiple-query-tag-performance-of-syatem/55336>\
**Category:** Ignition\
**Tags:** ignition79, vision\
**Created:** [January 25, 2022, 4:37am UTC](https://forum.inductiveautomation.com/t/ignition-multiple-query-tag-performance-of-syatem/55336 "2022-01-25T04:37:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Richita\_Pandey](https://avatars.discourse-cdn.com/v4/letter/r/6bbea6/32.png) [@Richita\_Pandey](https://forum.inductiveautomation.com/u/Richita_Pandey)\
**Post date:** [January 25, 2022, 4:37am UTC](https://forum.inductiveautomation.com/t/ignition-multiple-query-tag-performance-of-syatem/55336/1 "2022-01-25T04:37:23Z")

</div>

Hi all,

Need help to understand if I can use multiple SQL Query tags in a gateway and whether it will affect the system performance .  
My configuration is under the UDT I have created 1 SQL query tag with data type dataset. And it will return a single row with 10 columns. Again under UDT 10 more expression tags which are point/getting the value from the dataset.  
This query tag will be executed every 5 seconds and there are 200 Instance for this UDT, so 200 query firing every 5 seconds(single query takes fraction of seconds to retrieve data).

Is this approach correct or will this hamper the performance of the gateway?

Thank you.

---

<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 25, 2022, 1:14pm UTC](https://forum.inductiveautomation.com/t/ignition-multiple-query-tag-performance-of-syatem/55336/2 "2022-01-25T13:14:10Z")

</div>

So, forty queries per second. Not terrible, but no, not well-optimized. Consider pulling all 200 rows into a single dataset with a single query. Then use an expression to pull the correct row into the UDT’s dataset. (I would use my `view()` expression function, fwiw.) Leave the other expressions as-is.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [January 25, 2022, 1:20pm UTC](https://forum.inductiveautomation.com/t/ignition-multiple-query-tag-performance-of-syatem/55336/3 "2022-01-25T13:20:00Z")

</div>

I really need to convince my place to use your simulation aids. I’m having the same exact issue. Being able to reduce query load to a single query instead of 1 per UDT and just `view()`ing the right rows per UDT would really help the gateway load.

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [January 25, 2022, 1:58pm UTC](https://forum.inductiveautomation.com/t/ignition-multiple-query-tag-performance-of-syatem/55336/4 "2022-01-25T13:58:25Z")

</div>

You might be able to use the lookup expression as well if the query is nicely formed. We do something similar for a status bit for 1000s of UDTs reading from a database. A single tag reads the database and creates a dataset, and then a bit in the UDT uses lookup to get the correct data from that dataset.

---

<div class="post-metadata">

**Author:** ![Richita\_Pandey](https://avatars.discourse-cdn.com/v4/letter/r/6bbea6/32.png) [@Richita\_Pandey](https://forum.inductiveautomation.com/u/Richita_Pandey)\
**Post date:** [January 25, 2022, 4:13pm UTC](https://forum.inductiveautomation.com/t/ignition-multiple-query-tag-performance-of-syatem/55336/5 "2022-01-25T16:13:01Z")

</div>

I previously used the same approach but that particular query takes minimum 13-15secs to execute which ultimately gives a warning in log.  
Hence trying individual query for each instance.  
Will there be any other way to this?

---

<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 25, 2022, 4:43pm UTC](https://forum.inductiveautomation.com/t/ignition-multiple-query-tag-performance-of-syatem/55336/6 "2022-01-25T16:43:45Z")

</div>

> [@Richita\_Pandey](#):
>
> particular query takes minimum 13-15secs to execute

That suggests pathological complications in your DB (poor choice of indexes, etc). Please share your queries if you can.

---

<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 25, 2022, 4:44pm UTC](https://forum.inductiveautomation.com/t/ignition-multiple-query-tag-performance-of-syatem/55336/7 "2022-01-25T16:44:52Z")

</div>

Lookup can only grab one column value. My `view()` function can extract multiple rows and/or columns.
