#1485125: added index on messages.created

release-0.6
alecpl 17 years ago
parent dea6743660
commit c98f3b5d6e

@ -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`)
);

@ -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`);

@ -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`)

@ -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);

@ -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);

@ -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);

@ -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);

Loading…
Cancel
Save