Improved COUNT(docid) performance (added index).
h3rald h3rald@h3rald.com
Sun, 26 Apr 2015 18:11:30 +0200
2 files changed,
5 insertions(+),
0 deletions(-)
M
lib/core.nim
→
lib/core.nim
@@ -26,6 +26,7 @@ if file.fileExists():
raise newException(EDatastoreExists, "Datastore '$1' already exists." % file) let store = db.open(file, "", "", "") store.exec(SQL_CREATE_DOCUMENTS_TABLE) + store.exec(SQL_CREATE_DOCID_INDEX) store.exec(SQL_CREATE_SEARCHCONTENTS_TABLE) store.exec(SQL_CREATE_TAGS_TABLE)
M
lib/queries.nim
→
lib/queries.nim
@@ -15,6 +15,10 @@ created TEXT,
modified TEXT) """ +const SQL_CREATE_DOCID_INDEX* = sql""" +CREATE INDEX docid_index ON documents(docid) +""" + const SQL_CREATE_SEARCHCONTENTS_TABLE* = sql""" CREATE VIRTUAL TABLE searchcontents USING fts4( id TEXT,