From 43ee980446bcec445998660153020144b2c8639e Mon Sep 17 00:00:00 2001 From: Tyler Sweet Date: Mon, 3 Dec 2018 10:44:03 -0600 Subject: [PATCH 1/2] Add additional composite index to speed up display of pages where a device has a lot of syslogs. In our environment, this took page loads for some devices from over 60 seconds to nearly instant --- sql-schema/273.sql | 1 + 1 file changed, 1 insertion(+) create mode 100644 sql-schema/273.sql diff --git a/sql-schema/273.sql b/sql-schema/273.sql new file mode 100644 index 0000000000..1022c561b7 --- /dev/null +++ b/sql-schema/273.sql @@ -0,0 +1 @@ +ALTER TABLE `syslog` ADD KEY `device_id-timestamp` (`device_id`,`timestamp`); From 5c2f5c144496a08c82c749a63562e8f77cefecb2 Mon Sep 17 00:00:00 2001 From: Tyler Sweet Date: Mon, 3 Dec 2018 11:14:08 -0600 Subject: [PATCH 2/2] Forgot to add db_schema.yaml in previous commit --- misc/db_schema.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/misc/db_schema.yaml b/misc/db_schema.yaml index 48e73c948e..4827095dda 100644 --- a/misc/db_schema.yaml +++ b/misc/db_schema.yaml @@ -1561,6 +1561,7 @@ syslog: device_id: { Name: device_id, Columns: [device_id], Unique: false, Type: BTREE } program: { Name: program, Columns: [program], Unique: false, Type: BTREE } priority_level: { Name: priority_level, Columns: [priority, level], Unique: false, Type: BTREE } + device_id-timestamp: { Name: device_id-timestamp, Columns: [device_id, timestamp], Unique: false, Type: BTREE } tnmsneinfo: Columns: - { Field: id, Type: int(11), 'Null': false, Extra: auto_increment }