From e155de42ad2eb6b7e13f1eefbfbc10bdede5efdc Mon Sep 17 00:00:00 2001 From: Gregor Peach Date: Sun, 8 Mar 2020 19:22:39 -0400 Subject: [PATCH] Add index to speed up sorting by stat arrival time On the website getting the color requires finding the latest stat entry, which is hella slow without an index. Thus I added one --- create_tables.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/create_tables.sql b/create_tables.sql index f49845b..bc19f96 100644 --- a/create_tables.sql +++ b/create_tables.sql @@ -75,6 +75,8 @@ CREATE TABLE stats ms_latency_percentiles JSONB NOT NULL, PRIMARY KEY (stat_id) ); +DROP INDEX IF EXISTS stat_time_sort; +CREATE INDEX stat_time_sort ON stats (received_time DESC); CREATE TABLE logs (