Skip to content

Commit

Permalink
SQLiteJournal: optimizations [Closes #34]
Browse files Browse the repository at this point in the history
disabled foreign keys check
removed unnecessary indices
enabled journal_mode WAL
  • Loading branch information
sallyx authored and dg committed Nov 29, 2015
1 parent 39d9c44 commit f60c176
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Caching/Storages/SQLiteJournal.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand Down

0 comments on commit f60c176

Please sign in to comment.