From dd2a8b682cd669d98dd8ab2abf91620397fdc5ba Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Wed, 4 Mar 2020 15:17:50 -0500 Subject: [PATCH] Added indexes and mmap to the private db --- databases/_private.db.sql | 2 ++ databases/_sponsorTimes.db.sql | 4 +++- index.js | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/databases/_private.db.sql b/databases/_private.db.sql index dfd672a..b93aaee 100644 --- a/databases/_private.db.sql +++ b/databases/_private.db.sql @@ -13,4 +13,6 @@ CREATE TABLE IF NOT EXISTS "sponsorTimes" ( "hashedIP" TEXT NOT NULL, "timeSubmitted" INTEGER NOT NULL ); +CREATE INDEX IF NOT EXISTS sponsorTimes_hashedIP on sponsorTimes(hashedIP); +CREATE INDEX IF NOT EXISTS votes_userID on votes(UUID); COMMIT; diff --git a/databases/_sponsorTimes.db.sql b/databases/_sponsorTimes.db.sql index 647d40c..675ab5e 100644 --- a/databases/_sponsorTimes.db.sql +++ b/databases/_sponsorTimes.db.sql @@ -17,4 +17,6 @@ CREATE TABLE IF NOT EXISTS "userNames" ( "userID" TEXT NOT NULL, "userName" TEXT NOT NULL ); -COMMIT; +CREATE INDEX IF NOT EXISTS sponsorTimes_videoID on sponsorTimes(videoID); +CREATE INDEX IF NOT EXISTS sponsorTimes_UUID on sponsorTimes(UUID); +COMMIT; \ No newline at end of file diff --git a/index.js b/index.js index 2e62f74..c1f0711 100644 --- a/index.js +++ b/index.js @@ -51,6 +51,7 @@ if (!config.readOnly && config.mode === "production") { // Enable Memory-Mapped IO db.exec("pragma mmap_size= 500000000;"); +privateDB.exec("pragma mmap_size= 500000000;"); //setup CORS correctly app.use(function(req, res, next) {