Hello,
while I did some tests on the dev-database, I saw SELECTing information for a specific device is very slow:
SELECT COUNT(idx) FROM uradmonitor WHERE db_devid="11000035";
7.54 sec
SELECT * FROM uradmonitor WHERE db_devid="11000035" ORDER BY db_servertime DESC LIMIT 1;
8.88 sec
No speedup if you repeat this requests several times.
So I inserted a new Index for field ‘db_devid’.
CREATE INDEX idx_db_devid ON uradmonitor (db_devid);
Query OK, 15082335 rows affected (3 min 45.82 sec)
so the same queries are faster several times:
SELECT COUNT(idx) FROM uradmonitor WHERE db_devid="11000035";
0.78 sec
SELECT * FROM uradmonitor WHERE db_devid="11000035" ORDER BY db_servertime DESC LIMIT 1;
1.59 sec
Be aware, at the moment I don’t know if the db is write-protected during the initial creation of the index (we have to clear that). Maybe we could miss new entries …
Indices will reduce the INSERT-performance of this table, so I watched the cpu-load before and after the creation of the index. I could not see any difference. Maybe someone knows a better way to record this.
Vinz