Redo the database indexes, after some trial and error, to get some significant speed boosts in fetching articles and unread counts.
This commit is contained in:
parent
d738bff2ad
commit
33fe733a8e
|
@ -35,7 +35,7 @@ public final class ArticlesDatabase {
|
||||||
let createStatements = try! NSString(contentsOfFile: createStatementsPath, encoding: String.Encoding.utf8.rawValue)
|
let createStatements = try! NSString(contentsOfFile: createStatementsPath, encoding: String.Encoding.utf8.rawValue)
|
||||||
queue.createTables(usingStatements: createStatements as String)
|
queue.createTables(usingStatements: createStatements as String)
|
||||||
queue.update { (database) in
|
queue.update { (database) in
|
||||||
database.executeStatements("DROP TABLE if EXISTS tags;DROP INDEX if EXISTS tags_tagName_index;")
|
database.executeStatements("DROP TABLE if EXISTS tags;DROP INDEX if EXISTS tags_tagName_index;DROP INDEX if EXISTS articles_feedID_index;DROP INDEX if EXISTS statuses_read_index;")
|
||||||
}
|
}
|
||||||
queue.vacuumIfNeeded()
|
queue.vacuumIfNeeded()
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,6 @@ CREATE TABLE if not EXISTS authorsLookup (authorID TEXT NOT NULL, articleID TEXT
|
||||||
CREATE TABLE if not EXISTS attachments(attachmentID TEXT NOT NULL PRIMARY KEY, url TEXT NOT NULL, mimeType TEXT, title TEXT, sizeInBytes INTEGER, durationInSeconds INTEGER);
|
CREATE TABLE if not EXISTS attachments(attachmentID TEXT NOT NULL PRIMARY KEY, url TEXT NOT NULL, mimeType TEXT, title TEXT, sizeInBytes INTEGER, durationInSeconds INTEGER);
|
||||||
CREATE TABLE if not EXISTS attachmentsLookup(attachmentID TEXT NOT NULL, articleID TEXT NOT NULL, PRIMARY KEY(attachmentID, articleID));
|
CREATE TABLE if not EXISTS attachmentsLookup(attachmentID TEXT NOT NULL, articleID TEXT NOT NULL, PRIMARY KEY(attachmentID, articleID));
|
||||||
|
|
||||||
CREATE INDEX if not EXISTS articles_feedID_index on articles (feedID);
|
CREATE INDEX if not EXISTS articles_feedID_datePublished_articleID on articles (feedID, datePublished, articleID);
|
||||||
|
|
||||||
CREATE INDEX if not EXISTS statuses_read_index on statuses (read);
|
|
||||||
CREATE INDEX if not EXISTS statuses_starred_index on statuses (starred);
|
CREATE INDEX if not EXISTS statuses_starred_index on statuses (starred);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue