summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2009-09-07 12:40:05 +0000
committeralecpl <alec@alec.pl>2009-09-07 12:40:05 +0000
commit3d601d267dfb0ffca32ad953f36944b83910d907 (patch)
treef61fe2196a5a60efc483df9c4acdcf92bf5e6770
parenteb4b147badf67f7ddad520ec8be736333c930686 (diff)
- added index in messages table
-rw-r--r--SQL/mysql.initial.sql1
-rw-r--r--SQL/mysql.update.sql5
-rw-r--r--SQL/postgres.initial.sql1
-rw-r--r--SQL/postgres.update.sql4
-rw-r--r--SQL/sqlite.initial.sql3
-rw-r--r--SQL/sqlite.update.sql6
6 files changed, 19 insertions, 1 deletions
diff --git a/SQL/mysql.initial.sql b/SQL/mysql.initial.sql
index 9464dd702..75b6d6331 100644
--- a/SQL/mysql.initial.sql
+++ b/SQL/mysql.initial.sql
@@ -53,6 +53,7 @@ CREATE TABLE `messages` (
`structure` text,
PRIMARY KEY(`message_id`),
INDEX `created_index` (`created`),
+ INDEX `index_index` (`user_id`, `cache_key`, `idx`),
UNIQUE `uniqueness` (`user_id`, `cache_key`, `uid`),
CONSTRAINT `user_id_fk_messages` FOREIGN KEY (`user_id`)
REFERENCES `users`(`user_id`)
diff --git a/SQL/mysql.update.sql b/SQL/mysql.update.sql
index 5590099d0..f0cac2449 100644
--- a/SQL/mysql.update.sql
+++ b/SQL/mysql.update.sql
@@ -44,3 +44,8 @@ ALTER TABLE `cache`
ALTER TABLE `users`
CHANGE `language` `language` varchar(5);
+
+-- Updates from version 0.3-stable
+
+ALTER TABLE `messages`
+ ADD INDEX `index_index` (`user_id`, `cache_key`, `idx`);
diff --git a/SQL/postgres.initial.sql b/SQL/postgres.initial.sql
index 1a21ee28b..f07ca3029 100644
--- a/SQL/postgres.initial.sql
+++ b/SQL/postgres.initial.sql
@@ -174,4 +174,5 @@ CREATE TABLE messages (
);
ALTER TABLE messages ADD UNIQUE (user_id, cache_key, uid);
+CREATE INDEX messages_index_idx ON messages (user_id, cache_key, idx);
CREATE INDEX messages_created_idx ON messages (created);
diff --git a/SQL/postgres.update.sql b/SQL/postgres.update.sql
index a29558e66..6aba9b6a1 100644
--- a/SQL/postgres.update.sql
+++ b/SQL/postgres.update.sql
@@ -36,3 +36,7 @@ ALTER TABLE identities ALTER del TYPE smallint;
ALTER TABLE identities ALTER standard TYPE smallint;
ALTER TABLE contacts ALTER del TYPE smallint;
ALTER TABLE messages ALTER del TYPE smallint;
+
+-- Updates from version 0.3-stable
+
+CREATE INDEX messages_index_idx ON messages (user_id, cache_key, idx);
diff --git a/SQL/sqlite.initial.sql b/SQL/sqlite.initial.sql
index ef7cb4317..2395cfd49 100644
--- a/SQL/sqlite.initial.sql
+++ b/SQL/sqlite.initial.sql
@@ -119,5 +119,6 @@ CREATE TABLE messages (
structure text
);
-CREATE INDEX ix_messages_user_cache_uid ON messages(user_id,cache_key,uid);
+CREATE UNIQUE INDEX ix_messages_user_cache_uid ON messages (user_id,cache_key,uid);
+CREATE INDEX ix_messages_index ON messages (user_id,cache_key,idx);
CREATE INDEX ix_messages_created ON messages (created);
diff --git a/SQL/sqlite.update.sql b/SQL/sqlite.update.sql
index 627074e42..5c68cbb36 100644
--- a/SQL/sqlite.update.sql
+++ b/SQL/sqlite.update.sql
@@ -34,3 +34,9 @@ CREATE INDEX ix_messages_created ON messages (created);
CREATE INDEX ix_session_changed ON session (changed);
CREATE INDEX ix_cache_created ON cache (created);
+
+-- Updates from version 0.3-stable
+
+DROP INDEX ix_messages_user_cache_uid;
+CREATE UNIQUE INDEX ix_messages_user_cache_uid ON messages (user_id,cache_key,uid);
+CREATE INDEX ix_messages_index ON messages (user_id,cache_key,idx);