From 74d3c9b362e9ff57f21062c201cb79bb5462bf20 Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Sat, 26 Aug 2017 12:26:40 +0200 Subject: [PATCH] Add some indexes to make db accesses faster --- velib.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/velib.py b/velib.py index eea2578..c858ec7 100755 --- a/velib.py +++ b/velib.py @@ -38,7 +38,10 @@ def db_init(): "timestamp INTEGER, " + "event TEXT, " + "FOREIGN KEY(station_id) REFERENCES stations(id) ON DELETE CASCADE)") + c.execute("CREATE INDEX IF NOT EXISTS stationstats_station_id ON stationsstats (station_id)"); + c.execute("CREATE INDEX IF NOT EXISTS stationsstats_updated ON stationsstats (updated)"); c.execute("CREATE INDEX IF NOT EXISTS stationsevents_station_id ON stationsevents (station_id)"); + c.execute("CREATE INDEX IF NOT EXISTS stationsevents_timestamp ON stationsevents (timestamp)"); conn.commit() return conn