Finding Phantom Query

I have a project that has been deployed at a customer. Recently I visited to check on things, and the Log showed that a number of database queries were timing out. There is likely more than one issue here, but one thing I noticed was that when I went to the Gateway/Status/Connections/Databases and looked at “Active Queries” I could see that there was an INSERT statement that had an empty VALUES clause. It was pointed at the table I have set up for Auditing and it appeared to always be running. I tried to Cancel it, but it just created a new instance.

My issue is that I don’t use that INSERT statement anywhere (at least not anymore). I looked everywhere I could think of and used the Find on literally everything with just the word “insert” and could not find any instance of this statement.

Are there any other search methods or ways for me to find where this query is running from?

When you did a control+F to look for INSERT, did you make sure all open windows, views, scripts, etc were checked off?

Is there a pattern to the inserts ie every 5 minutes? Check your gateway and client event timers. Or perhaps its on an actual tag change event (as opposed to a gateway tag change event). If you see what table it is inserting into, try searching for that table name instead to get you in the right area of the project.

Thats all I got. Unfortunately afaik Ignition will record your queries into the Active Queries/Slow queries log when appropriate, but it will not say “Called from Window X\Script Y\View Z” unfortunately. In the future though you could make your own wrapper function that keeps track of that though.

Yeah, I made sure to select all of the things in each of the categories, but no luck.

The form of the insert statement looks like what I had done for auditable events before I found the system.util.audit command.

Looked in all Client and Gateway event scripts and it’s not in there. The tag change script is an interesting thought, I’ll have to look there (on the assumption that the find didn’t turn up something defined in the tags).

Thanks for the advice.