We had a mysterious mysql database issue the other day and while debugging some of that I noticed some odd queries running from the ignition instance. I suspect the index got corrupted even though repairing does not fix it but that is another issue I suspect.
The query looks something like:
SELECT `id`, `intvalue`, `floatvalue`, `stringvalue`, `datevalue`, `dataintegrity` FROM sqlt_core WHERE `valuechange`>? and `configchange`<? AND `drivername`<>?
The first issue I noticed was this clause drivername
<>?. The second issue is that the ? parameter was a lower case version of the Driver Name which happens to be entered in all upper case in the configuration.
So first thing I notice is this query will end up doing a full table scan as most indexes don’t really apply according the explain plan. It only has something like 120000 rows in sqlt_core so not that big of an issue unless is always used. This query was running for 1+ days when I found it according to mysql which is obviously a problem but the execution time is most likely due to mysql corruption.
Ultimate question is this query doing the right thing? It may be that it works correctly due to the incorrect case which just happens make things work and if we lower cased the driver name it would stop working.
Misc Info:
Ignition 7.4.3 32-bit
Maria DB 5.5.27