Add some indexes to make db accesses faster
This commit is contained in:
parent
ae11b73933
commit
74d3c9b362
3
velib.py
3
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user