Permalink
Browse files

#1485125: added index on messages.created

  • Loading branch information...
1 parent dea6743 commit c98f3b5d6e4c681b7e42ea71c32cd2ef1991b519 @alecpl alecpl committed Jun 12, 2008
View
@@ -119,6 +119,7 @@ CREATE TABLE `messages` (
`headers` text NOT NULL,
`structure` text,
PRIMARY KEY (`message_id`),
+ INDEX `created_index` (`created`),
UNIQUE `uniqueness` (`user_id`, `cache_key`, `uid`)
);
View
@@ -25,3 +25,8 @@ ALTER TABLE `identities`
MODIFY `organization` varchar(128) NOT NULL DEFAULT '',
MODIFY `name` varchar(128) NOT NULL,
MODIFY `email` varchar(128) NOT NULL;
+
+-- Updates from version 0.2-alpha
+
+ALTER TABLE `messages`
+ ADD INDEX `created_index` (`created`);
View
@@ -54,6 +54,7 @@ CREATE TABLE `messages` (
`headers` text NOT NULL,
`structure` text,
PRIMARY KEY(`message_id`),
+ INDEX `created_index` (`created`),
UNIQUE `uniqueness` (`user_id`, `cache_key`, `uid`),
CONSTRAINT `user_id_fk_messages` FOREIGN KEY (`user_id`)
REFERENCES `users`(`user_id`)
View
@@ -152,7 +152,7 @@ CREATE SEQUENCE message_ids
-- Name: messages; Type: TABLE; Schema: public; Owner: postgres
--
-CREATE TABLE "messages" (
+CREATE TABLE messages (
message_id integer DEFAULT nextval('message_ids'::text) PRIMARY KEY,
user_id integer NOT NULL REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
del integer DEFAULT 0 NOT NULL,
@@ -170,4 +170,5 @@ CREATE TABLE "messages" (
structure text
);
-ALTER TABLE "messages" ADD UNIQUE (user_id, cache_key, uid);
+ALTER TABLE messages ADD UNIQUE (user_id, cache_key, uid);
+CREATE INDEX messages_created_idx ON messages (created);
View
@@ -17,3 +17,7 @@ ALTER TABLE contacts DROP CONSTRAINT contacts_user_id_fkey;
ALTER TABLE contacts ADD FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE cache DROP CONSTRAINT cache_user_id_fkey;
ALTER TABLE cache ADD FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE ON UPDATE CASCADE;
+
+-- Updates from version 0.2-alpha
+
+CREATE INDEX messages_created_idx ON messages (created);
View
@@ -123,3 +123,4 @@ CREATE TABLE messages (
);
CREATE INDEX ix_messages_user_cache_uid ON messages(user_id,cache_key,uid);
+CREATE INDEX ix_messages_created ON messages (created);
View
@@ -25,3 +25,7 @@ CREATE INDEX ix_messages_user_cache_uid ON messages(user_id,cache_key,uid);
CREATE INDEX ix_users_username ON users(username);
CREATE INDEX ix_users_alias ON users(alias);
+
+-- Updates from version 0.2-alpha
+
+CREATE INDEX ix_messages_created ON messages (created);

0 comments on commit c98f3b5

Please sign in to comment.