针对某个大表查询比较慢,
加一个表,存放最新的记录,查询时 查询该表 提高查询性能
DROP TRIGGER trigger_tableBigDataLastest
CREATE TABLE tableBigDataLatest LIKE runningrecord
CREATE TRIGGER trigger_tableBigDataLatest
AFTER INSERT
ON tableBigData
FOR EACH ROW
BEGIN
DELETE FROM tableBigData WHERE SystemNo=new.SystemNo ;
INSERT INTO tableBigData( SystemNo, Longitude, Latitude, CurrentValue, `MaxValue`, MinValue)
VALUES(new.SystemNo, new.Longitude, new.Latitude,new.CurrentValue, new.`MaxValue`, new.MinValue );
END;