From c96cb7de0ecb8856470c0cd2e5ed87b719d53065 Mon Sep 17 00:00:00 2001 From: "Bora M. Alper" Date: Tue, 6 Jun 2017 15:13:26 +0300 Subject: [PATCH] created index for discovered_on to speedup statistics --- magneticow/magneticow/magneticow.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/magneticow/magneticow/magneticow.py b/magneticow/magneticow/magneticow.py index 293afea..4ba1d56 100644 --- a/magneticow/magneticow/magneticow.py +++ b/magneticow/magneticow/magneticow.py @@ -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');")