Permalink
Browse files

- added index in messages table

  • Loading branch information...
1 parent eb4b147 commit 3d601d267dfb0ffca32ad953f36944b83910d907 @alecpl alecpl committed Sep 7, 2009
Showing with 19 additions and 1 deletion.
  1. +1 −0 SQL/mysql.initial.sql
  2. +5 −0 SQL/mysql.update.sql
  3. +1 −0 SQL/postgres.initial.sql
  4. +4 −0 SQL/postgres.update.sql
  5. +2 −1 SQL/sqlite.initial.sql
  6. +6 −0 SQL/sqlite.update.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`)
@@ -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`);
@@ -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);
@@ -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);
@@ -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);
@@ -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);

0 comments on commit 3d601d2

Please sign in to comment.