created index for discovered_on to speedup statistics

This commit is contained in:
Bora M. Alper 2017-06-06 15:13:26 +03:00
parent 3960915812
commit c96cb7de0e

View File

@ -251,6 +251,8 @@ def initialize_magneticod_db() -> None:
with magneticod_db:
magneticod_db.execute("PRAGMA journal_mode=WAL;")
magneticod_db.execute("CREATE INDEX IF NOT EXISTS discovered_on_index ON torrents (discovered_on);")
magneticod_db.execute("CREATE VIRTUAL TABLE temp.fts_torrents USING fts4(name);")
magneticod_db.execute("INSERT INTO fts_torrents (docid, name) SELECT id, name FROM torrents;")
magneticod_db.execute("INSERT INTO fts_torrents (fts_torrents) VALUES ('optimize');")