summaryrefslogtreecommitdiff
path: root/SQL
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2008-11-24 07:59:10 +0000
committeralecpl <alec@alec.pl>2008-11-24 07:59:10 +0000
commite4d9f05e4126501ce329fc4c36704375f6dfe681 (patch)
treecb676b255788ddadead29dc86db32a187da5a520 /SQL
parentae9124d3a92e2fd1d507d9dcba49209463391ad7 (diff)
- Added index on cache.created + small fixes in mssql DDL script
Diffstat (limited to 'SQL')
-rw-r--r--SQL/mssql.initial.sql13
-rw-r--r--SQL/mysql.initial.sql1
-rw-r--r--SQL/mysql.update.sql3
-rw-r--r--SQL/mysql5.initial.sql1
-rw-r--r--SQL/postgres.initial.sql1
-rw-r--r--SQL/postgres.update.sql1
-rw-r--r--SQL/sqlite.initial.sql1
-rw-r--r--SQL/sqlite.update.sql1
8 files changed, 20 insertions, 2 deletions
diff --git a/SQL/mssql.initial.sql b/SQL/mssql.initial.sql
index 162495781..98412de2b 100644
--- a/SQL/mssql.initial.sql
+++ b/SQL/mssql.initial.sql
@@ -128,6 +128,9 @@ GO
CREATE INDEX [IX_cache_cache_key] ON [dbo].[cache]([cache_key]) ON [PRIMARY]
GO
+ CREATE INDEX [IX_cache_created] ON [dbo].[cache]([created]) ON [PRIMARY]
+GO
+
ALTER TABLE [dbo].[contacts] ADD
CONSTRAINT [DF_contacts_user_id] DEFAULT (0) FOR [user_id],
CONSTRAINT [DF_contacts_changed] DEFAULT (getdate()) FOR [changed],
@@ -179,10 +182,10 @@ GO
CREATE INDEX [IX_messages_cache_key] ON [dbo].[messages]([cache_key]) ON [PRIMARY]
GO
- CREATE INDEX [IX_messages_idx] ON [dbo].[messages]([idx]) ON [PRIMARY]
+ CREATE INDEX [IX_messages_uid] ON [dbo].[messages]([uid]) ON [PRIMARY]
GO
- CREATE INDEX [IX_messages_uid] ON [dbo].[messages]([uid]) ON [PRIMARY]
+ CREATE INDEX [IX_messages_created] ON [dbo].[messages]([created]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[session] ADD
@@ -202,3 +205,9 @@ ALTER TABLE [dbo].[users] ADD
CONSTRAINT [DF_users_language] DEFAULT ('en') FOR [language]
GO
+ CREATE INDEX [IX_users_username] ON [dbo].[users]([username]) ON [PRIMARY]
+GO
+
+ CREATE INDEX [IX_users_alias] ON [dbo].[users]([alias]) ON [PRIMARY]
+GO
+
diff --git a/SQL/mysql.initial.sql b/SQL/mysql.initial.sql
index 0f9fc8b92..4fa6a003a 100644
--- a/SQL/mysql.initial.sql
+++ b/SQL/mysql.initial.sql
@@ -15,6 +15,7 @@ CREATE TABLE `cache` (
`created` datetime NOT NULL default '0000-00-00 00:00:00',
`data` longtext NOT NULL,
PRIMARY KEY (`cache_id`),
+ INDEX `created_index` (`created`),
INDEX `user_cache_index` (`user_id`,`cache_key`)
);
diff --git a/SQL/mysql.update.sql b/SQL/mysql.update.sql
index 1e8979d87..74ff5330f 100644
--- a/SQL/mysql.update.sql
+++ b/SQL/mysql.update.sql
@@ -38,3 +38,6 @@ ALTER TABLE `cache`
ALTER TABLE `session`
ADD INDEX `changed_index` (`changed`);
+
+ALTER TABLE `cache`
+ ADD INDEX `created_index` (`created`);
diff --git a/SQL/mysql5.initial.sql b/SQL/mysql5.initial.sql
index b162e4ddf..54dee1dba 100644
--- a/SQL/mysql5.initial.sql
+++ b/SQL/mysql5.initial.sql
@@ -73,6 +73,7 @@ CREATE TABLE `cache` (
`data` longtext NOT NULL,
`user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY(`cache_id`),
+ INDEX `created_index` (`created`),
INDEX `user_cache_index` (`user_id`,`cache_key`),
CONSTRAINT `user_id_fk_cache` FOREIGN KEY (`user_id`)
REFERENCES `users`(`user_id`)
diff --git a/SQL/postgres.initial.sql b/SQL/postgres.initial.sql
index 9fb8d32fb..b5f7779d7 100644
--- a/SQL/postgres.initial.sql
+++ b/SQL/postgres.initial.sql
@@ -135,6 +135,7 @@ CREATE TABLE "cache" (
);
CREATE INDEX cache_user_id_idx ON "cache" (user_id, cache_key);
+CREATE INDEX cache_created_idx ON "cache" (created);
--
-- Sequence "message_ids"
diff --git a/SQL/postgres.update.sql b/SQL/postgres.update.sql
index 6832b962f..14fdc9753 100644
--- a/SQL/postgres.update.sql
+++ b/SQL/postgres.update.sql
@@ -27,3 +27,4 @@ CREATE INDEX messages_created_idx ON messages (created);
ALTER TABLE cache DROP session_id;
CREATE INDEX session_changed_idx ON session (changed);
+CREATE INDEX cache_created_idx ON "cache" (created);
diff --git a/SQL/sqlite.initial.sql b/SQL/sqlite.initial.sql
index e78ce42b5..e89f0d16a 100644
--- a/SQL/sqlite.initial.sql
+++ b/SQL/sqlite.initial.sql
@@ -17,6 +17,7 @@ CREATE TABLE cache (
);
CREATE INDEX ix_cache_user_cache_key ON cache(user_id, cache_key);
+CREATE INDEX ix_cache_created ON cache(created);
-- --------------------------------------------------------
diff --git a/SQL/sqlite.update.sql b/SQL/sqlite.update.sql
index 26dc00f4f..627074e42 100644
--- a/SQL/sqlite.update.sql
+++ b/SQL/sqlite.update.sql
@@ -33,3 +33,4 @@ CREATE INDEX ix_messages_created ON messages (created);
-- Updates from version 0.2-beta
CREATE INDEX ix_session_changed ON session (changed);
+CREATE INDEX ix_cache_created ON cache (created);