Added indexes and mmap to the private db

This commit is contained in:
Ajay Ramachandran
2020-03-04 15:17:50 -05:00
parent d226c52630
commit dd2a8b682c
3 changed files with 6 additions and 1 deletions

View File

@@ -13,4 +13,6 @@ CREATE TABLE IF NOT EXISTS "sponsorTimes" (
"hashedIP" TEXT NOT NULL, "hashedIP" TEXT NOT NULL,
"timeSubmitted" INTEGER 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; COMMIT;

View File

@@ -17,4 +17,6 @@ CREATE TABLE IF NOT EXISTS "userNames" (
"userID" TEXT NOT NULL, "userID" TEXT NOT NULL,
"userName" 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;

View File

@@ -51,6 +51,7 @@ if (!config.readOnly && config.mode === "production") {
// Enable Memory-Mapped IO // Enable Memory-Mapped IO
db.exec("pragma mmap_size= 500000000;"); db.exec("pragma mmap_size= 500000000;");
privateDB.exec("pragma mmap_size= 500000000;");
//setup CORS correctly //setup CORS correctly
app.use(function(req, res, next) { app.use(function(req, res, next) {