From f60c1767fe5a4b2b45edf2a98cf9dc70c15ea1b1 Mon Sep 17 00:00:00 2001 From: sallyx Date: Sat, 24 Oct 2015 11:21:59 +0200 Subject: [PATCH] SQLiteJournal: optimizations [Closes #34] disabled foreign keys check removed unnecessary indices enabled journal_mode WAL --- src/Caching/Storages/SQLiteJournal.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Caching/Storages/SQLiteJournal.php b/src/Caching/Storages/SQLiteJournal.php index 0a30eba6..1c04280e 100644 --- a/src/Caching/Storages/SQLiteJournal.php +++ b/src/Caching/Storages/SQLiteJournal.php @@ -32,7 +32,8 @@ public function __construct($path = ':memory:') $this->pdo = new \PDO('sqlite:' . $path); $this->pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $this->pdo->exec(' - PRAGMA foreign_keys = ON; + PRAGMA foreign_keys = OFF; + PRAGMA journal_mode = WAL; CREATE TABLE IF NOT EXISTS tags ( key BLOB NOT NULL, tag BLOB NOT NULL @@ -41,7 +42,6 @@ public function __construct($path = ':memory:') key BLOB NOT NULL, priority INT NOT NULL ); - CREATE INDEX IF NOT EXISTS idx_tags_key ON tags(key); CREATE INDEX IF NOT EXISTS idx_tags_tag ON tags(tag); CREATE UNIQUE INDEX IF NOT EXISTS idx_tags_key_tag ON tags(key, tag); CREATE UNIQUE INDEX IF NOT EXISTS idx_priorities_key ON priorities(key);