I have mi Ignition project linked to an SQL Server database, and I have created some Query Tags inside of it. The thing is, while inside the SQL Server each variable on the table updates every 3 seconds, the Query Tags change their value around 10 seconds. Is there any way for the tags to update at the same rate as the SMSS?
Here is the structure of a used Query if it helps, accessing the latest value of the number_value column of the specified tag:
SELECT TOP 1 number_value
FROM DerivedTags
WHERE tag = '/DT/SUM_CC_01_POWER'
ORDER BY ts DESC
Basically, on the Execution Mode option inside of the tag menu, it has been setted to Tag Group named Default, which has been configured to 1000ms both the default and the default historical
The problem was solved partialy by creating a separate database for each of the plants that we wanted to visualize on the perspective application.
With that, the values should update around 2-3 seconds, but they update around 8-10 seconds each. Maybe is for the use of several Power Charts with the history option enabled.
On another post I saw someone that said that using SET ARITHABORT ON command before the execution could help with the slow queries, but when I try to implement it on a Query Tag it says that there's an error. The used code is the following:
SET ARITHABORT ON
SELECT TOP 1 number_value
FROM tags_data
WHERE tag = '/Blue_Mountain_WWTP/CC_01_POWER'
ORDER BY ts DESC
Without the ARITHABORT, the query seems to execute fine, updating around 8-10 seconds as it has been said. But with the instruction, it says Error_Expression. What could be the problem?
You didn't answer Jordan's question about indices. With proper indices, that kind of simple query should execute in a few milliseconds. Have your IT people fix their databases.