The alarm_events table has ~11 million rows (1-year alarm retention). Queries executed against different tables in the same database take milliseconds, so I’m inclined to think that problems are related to this table specifically.
I don’t think I can change these queries, so, in an attempt to fix them, I added an index to eventtime on our development gateway/database. This seems to have resolved the slow query errors and hasn’t introduced any noticeable performance impacts.
Some questions before I add the same index to our production database:
Can anyone think of a reason I shouldn’t?
Are there performance or maintainability concerns I have failed to consider?
If this solution has no drawbacks is there a reason why it’s not default behavior when the table is automatically created?
Looks like MariaDB will auto-name it if you don't give an explicit one. I just tried that command on a test server and SHOW CREATE TABLE is now giving me this, which looks about like I'd expect: