aboutsummaryrefslogtreecommitdiffhomepage
path: root/app
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2019-08-08 09:36:03 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2019-08-08 09:36:03 +0200
commit0810c75e0bd2aa008d69da819a7c51207f159854 (patch)
tree44b0df44832eb96797877faf336679c280c7ee33 /app
parent2b0f4e86b27fec39f5e172fbeba9ce033aef2e79 (diff)
downloadwallabag-0810c75e0bd2aa008d69da819a7c51207f159854.tar.gz
wallabag-0810c75e0bd2aa008d69da819a7c51207f159854.tar.zst
wallabag-0810c75e0bd2aa008d69da819a7c51207f159854.zip
Add `tag_label` & `config_feed_token` index
Diffstat (limited to 'app')
-rw-r--r--app/DoctrineMigrations/Version20190806130304.php20
1 files changed, 19 insertions, 1 deletions
diff --git a/app/DoctrineMigrations/Version20190806130304.php b/app/DoctrineMigrations/Version20190806130304.php
index ca94c080..c577509d 100644
--- a/app/DoctrineMigrations/Version20190806130304.php
+++ b/app/DoctrineMigrations/Version20190806130304.php
@@ -6,7 +6,13 @@ use Doctrine\DBAL\Schema\Schema;
6use Wallabag\CoreBundle\Doctrine\WallabagMigration; 6use Wallabag\CoreBundle\Doctrine\WallabagMigration;
7 7
8/** 8/**
9 * Adding more index to kill some slow queries. 9 * Adding more index to kill some slow queries:
10 * - user_language
11 * - user_archived
12 * - user_created
13 * - user_starred
14 * - tag_label
15 * - config_feed_token
10 */ 16 */
11final class Version20190806130304 extends WallabagMigration 17final class Version20190806130304 extends WallabagMigration
12{ 18{
@@ -35,6 +41,8 @@ final class Version20190806130304 extends WallabagMigration
35 $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry', true) . ' (user_id, is_archived, archived_at)'); 41 $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry', true) . ' (user_id, is_archived, archived_at)');
36 $this->addSql('CREATE INDEX user_created ON ' . $this->getTable('entry', true) . ' (user_id, created_at)'); 42 $this->addSql('CREATE INDEX user_created ON ' . $this->getTable('entry', true) . ' (user_id, created_at)');
37 $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry', true) . ' (user_id, is_starred, starred_at)'); 43 $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry', true) . ' (user_id, is_starred, starred_at)');
44 $this->addSql('CREATE INDEX tag_label ON ' . $this->getTable('tag', true) . ' (label)');
45 $this->addSql('CREATE INDEX config_feed_token ON ' . $this->getTable('config', true) . ' (feed_token)');
38 break; 46 break;
39 case 'mysql': 47 case 'mysql':
40 $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' MODIFY language VARCHAR(20) DEFAULT NULL'); 48 $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' MODIFY language VARCHAR(20) DEFAULT NULL');
@@ -42,6 +50,8 @@ final class Version20190806130304 extends WallabagMigration
42 $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry') . ' (user_id, is_archived, archived_at)'); 50 $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry') . ' (user_id, is_archived, archived_at)');
43 $this->addSql('CREATE INDEX user_created ON ' . $this->getTable('entry') . ' (user_id, created_at)'); 51 $this->addSql('CREATE INDEX user_created ON ' . $this->getTable('entry') . ' (user_id, created_at)');
44 $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)'); 52 $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)');
53 $this->addSql('CREATE INDEX tag_label ON ' . $this->getTable('tag') . ' (label (255))');
54 $this->addSql('CREATE INDEX config_feed_token ON ' . $this->getTable('config') . ' (feed_token (255))');
45 break; 55 break;
46 case 'postgresql': 56 case 'postgresql':
47 $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER language TYPE VARCHAR(20)'); 57 $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER language TYPE VARCHAR(20)');
@@ -49,6 +59,8 @@ final class Version20190806130304 extends WallabagMigration
49 $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry') . ' (user_id, is_archived, archived_at)'); 59 $this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry') . ' (user_id, is_archived, archived_at)');
50 $this->addSql('CREATE INDEX user_created ON ' . $this->getTable('entry') . ' (user_id, created_at)'); 60 $this->addSql('CREATE INDEX user_created ON ' . $this->getTable('entry') . ' (user_id, created_at)');
51 $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)'); 61 $this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)');
62 $this->addSql('CREATE INDEX tag_label ON ' . $this->getTable('tag') . ' (label)');
63 $this->addSql('CREATE INDEX config_feed_token ON ' . $this->getTable('config') . ' (feed_token)');
52 break; 64 break;
53 } 65 }
54 } 66 }
@@ -66,6 +78,8 @@ final class Version20190806130304 extends WallabagMigration
66 $this->addSql('DROP INDEX user_archived'); 78 $this->addSql('DROP INDEX user_archived');
67 $this->addSql('DROP INDEX user_created'); 79 $this->addSql('DROP INDEX user_created');
68 $this->addSql('DROP INDEX user_starred'); 80 $this->addSql('DROP INDEX user_starred');
81 $this->addSql('DROP INDEX tag_label');
82 $this->addSql('DROP INDEX config_feed_token');
69 $this->addSql('CREATE TEMPORARY TABLE __temp__wallabag_entry AS SELECT id, user_id, uid, title, url, hashed_url, origin_url, given_url, hashed_given_url, is_archived, archived_at, is_starred, content, created_at, updated_at, published_at, published_by, starred_at, mimetype, language, reading_time, domain_name, preview_picture, http_status, headers FROM ' . $this->getTable('entry', true)); 83 $this->addSql('CREATE TEMPORARY TABLE __temp__wallabag_entry AS SELECT id, user_id, uid, title, url, hashed_url, origin_url, given_url, hashed_given_url, is_archived, archived_at, is_starred, content, created_at, updated_at, published_at, published_by, starred_at, mimetype, language, reading_time, domain_name, preview_picture, http_status, headers FROM ' . $this->getTable('entry', true));
70 $this->addSql('DROP TABLE ' . $this->getTable('entry', true)); 84 $this->addSql('DROP TABLE ' . $this->getTable('entry', true));
71 $this->addSql('CREATE TABLE ' . $this->getTable('entry', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, uid VARCHAR(23) DEFAULT NULL, title CLOB DEFAULT NULL, url CLOB DEFAULT NULL, hashed_url VARCHAR(40) DEFAULT NULL, origin_url CLOB DEFAULT NULL, given_url CLOB DEFAULT NULL, hashed_given_url VARCHAR(40) DEFAULT NULL, is_archived BOOLEAN NOT NULL, archived_at DATETIME DEFAULT NULL, is_starred BOOLEAN NOT NULL, content CLOB DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, published_at DATETIME DEFAULT NULL, published_by CLOB DEFAULT NULL --(DC2Type:array) 85 $this->addSql('CREATE TABLE ' . $this->getTable('entry', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, uid VARCHAR(23) DEFAULT NULL, title CLOB DEFAULT NULL, url CLOB DEFAULT NULL, hashed_url VARCHAR(40) DEFAULT NULL, origin_url CLOB DEFAULT NULL, given_url CLOB DEFAULT NULL, hashed_given_url VARCHAR(40) DEFAULT NULL, is_archived BOOLEAN NOT NULL, archived_at DATETIME DEFAULT NULL, is_starred BOOLEAN NOT NULL, content CLOB DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, published_at DATETIME DEFAULT NULL, published_by CLOB DEFAULT NULL --(DC2Type:array)
@@ -85,6 +99,8 @@ final class Version20190806130304 extends WallabagMigration
85 $this->addSql('DROP INDEX user_archived ON ' . $this->getTable('entry')); 99 $this->addSql('DROP INDEX user_archived ON ' . $this->getTable('entry'));
86 $this->addSql('DROP INDEX user_created ON ' . $this->getTable('entry')); 100 $this->addSql('DROP INDEX user_created ON ' . $this->getTable('entry'));
87 $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry')); 101 $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry'));
102 $this->addSql('DROP INDEX tag_label ON ' . $this->getTable('tag'));
103 $this->addSql('DROP INDEX config_feed_token ON ' . $this->getTable('config'));
88 break; 104 break;
89 case 'postgresql': 105 case 'postgresql':
90 $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER language TYPE TEXT'); 106 $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER language TYPE TEXT');
@@ -92,6 +108,8 @@ final class Version20190806130304 extends WallabagMigration
92 $this->addSql('DROP INDEX user_archived ON ' . $this->getTable('entry')); 108 $this->addSql('DROP INDEX user_archived ON ' . $this->getTable('entry'));
93 $this->addSql('DROP INDEX user_created ON ' . $this->getTable('entry')); 109 $this->addSql('DROP INDEX user_created ON ' . $this->getTable('entry'));
94 $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry')); 110 $this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry'));
111 $this->addSql('DROP INDEX tag_label ON ' . $this->getTable('tag'));
112 $this->addSql('DROP INDEX config_feed_token ON ' . $this->getTable('config'));
95 break; 113 break;
96 } 114 }
97 } 115 }