From 129caa06a4f09163caca0c6e655029684d946259 Mon Sep 17 00:00:00 2001 From: simon Date: Wed, 7 Jul 2021 19:17:26 +0700 Subject: [PATCH] indexing on epoch_time for faster where queries --- postgres/setup.sql | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/postgres/setup.sql b/postgres/setup.sql index c9e64d7..56ad72d 100644 --- a/postgres/setup.sql +++ b/postgres/setup.sql @@ -11,6 +11,9 @@ CREATE TABLE aqi ( aqi_category VARCHAR(40) NOT NULL ); +-- index for epoch_time where queries +CREATE INDEX aqi_epochtime ON aqi (epoch_time DESC); + -- example aqi insert INSERT INTO aqi ( epoch_time, @@ -41,6 +44,9 @@ CREATE TABLE weather ( weather_icon VARCHAR(3) NOT NULL ); +-- index for epoch_time where queries +CREATE INDEX weather_epochtime ON weather (epoch_time DESC); + -- example weather insert INSERT INTO weather ( epoch_time,