summaryrefslogtreecommitdiff
path: root/SQL
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2008-11-21 18:19:30 +0000
committeralecpl <alec@alec.pl>2008-11-21 18:19:30 +0000
commit3e48d2eee1d2af42aa777fd5e461fa570762732e (patch)
treea578fc94ebb4ad6618c4785138498ea03939b9ab /SQL
parentbe7d3b6918ff90757d10804ac914edb5a65f4828 (diff)
- Increase speed of session destroy and garbage clean up
- Fix session timeout when DB server got clock skew (#1485490)
Diffstat (limited to 'SQL')
-rw-r--r--SQL/mssql.initial.sql3
-rw-r--r--SQL/mysql.initial.sql3
-rw-r--r--SQL/mysql.update.sql3
-rw-r--r--SQL/mysql5.initial.sql3
-rw-r--r--SQL/postgres.initial.sql1
-rw-r--r--SQL/postgres.update.sql6
-rw-r--r--SQL/sqlite.initial.sql1
-rw-r--r--SQL/sqlite.update.sql4
8 files changed, 20 insertions, 4 deletions
diff --git a/SQL/mssql.initial.sql b/SQL/mssql.initial.sql
index f3b5d5ca7..fc60a4d8d 100644
--- a/SQL/mssql.initial.sql
+++ b/SQL/mssql.initial.sql
@@ -196,6 +196,9 @@ ALTER TABLE [dbo].[session] ADD
CONSTRAINT [DF_session_ip] DEFAULT ('') FOR [ip]
GO
+ CREATE INDEX [IX_session_changed] ON [dbo].[session]([changed]) ON [PRIMARY]
+GO
+
ALTER TABLE [dbo].[users] ADD
CONSTRAINT [DF_users_username] DEFAULT ('') FOR [username],
CONSTRAINT [DF_users_mail_host] DEFAULT ('') FOR [mail_host],
diff --git a/SQL/mysql.initial.sql b/SQL/mysql.initial.sql
index c71894257..07f127cce 100644
--- a/SQL/mysql.initial.sql
+++ b/SQL/mysql.initial.sql
@@ -73,7 +73,8 @@ CREATE TABLE `session` (
`changed` datetime NOT NULL default '0000-00-00 00:00:00',
`ip` VARCHAR(40) NOT NULL default '',
`vars` text NOT NULL,
- PRIMARY KEY (`sess_id`)
+ PRIMARY KEY (`sess_id`),
+ INDEX `changed_index` (`changed`)
);
-- --------------------------------------------------------
diff --git a/SQL/mysql.update.sql b/SQL/mysql.update.sql
index f88a6c4db..a45ace1fd 100644
--- a/SQL/mysql.update.sql
+++ b/SQL/mysql.update.sql
@@ -38,3 +38,6 @@ ALTER TABLE `cache`
REFERENCES `session`(`sess_id`)
ON DELETE CASCADE
ON UPDATE CASCADE;
+
+ALTER TABLE `session`
+ ADD INDEX `changed_index` (`changed`);
diff --git a/SQL/mysql5.initial.sql b/SQL/mysql5.initial.sql
index e01f2a6b1..7d11288e3 100644
--- a/SQL/mysql5.initial.sql
+++ b/SQL/mysql5.initial.sql
@@ -14,7 +14,8 @@ CREATE TABLE `session` (
`changed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`ip` varchar(40) NOT NULL,
`vars` text NOT NULL,
- PRIMARY KEY(`sess_id`)
+ PRIMARY KEY(`sess_id`),
+ INDEX `changed_index` (`changed`)
) TYPE=INNODB CHARACTER SET utf8 COLLATE utf8_general_ci;
diff --git a/SQL/postgres.initial.sql b/SQL/postgres.initial.sql
index e53caa187..128b484d7 100644
--- a/SQL/postgres.initial.sql
+++ b/SQL/postgres.initial.sql
@@ -42,6 +42,7 @@ CREATE TABLE "session" (
vars text NOT NULL
);
+CREATE INDEX session_changed_idx ON session (changed);
--
diff --git a/SQL/postgres.update.sql b/SQL/postgres.update.sql
index fdd7f0f5e..f9cd431b6 100644
--- a/SQL/postgres.update.sql
+++ b/SQL/postgres.update.sql
@@ -25,5 +25,7 @@ CREATE INDEX messages_created_idx ON messages (created);
-- Updates from version 0.2-beta
ALTER TABLE cache DROP CONSTRAINT cache_session_id_fkey;
-ALTER TABLE cache ADD FOREIGN KEY (session_id) REFERENCES session(sess_id) ON DELETE CASCADE ON UPDATE CASCADE;
-CREATE INDEX cache_session_id_idx ON "cache" (session_id);
+ALTER TABLE cache ADD FOREIGN KEY (session_id) REFERENCES session (sess_id) ON DELETE CASCADE ON UPDATE CASCADE;
+
+CREATE INDEX cache_session_id_idx ON cache (session_id);
+CREATE INDEX session_changed_idx ON session (changed);
diff --git a/SQL/sqlite.initial.sql b/SQL/sqlite.initial.sql
index 4b2c30faa..d09539d6f 100644
--- a/SQL/sqlite.initial.sql
+++ b/SQL/sqlite.initial.sql
@@ -97,6 +97,7 @@ CREATE TABLE session (
vars text NOT NULL
);
+CREATE INDEX ix_session_changed ON session (changed);
-- --------------------------------------------------------
diff --git a/SQL/sqlite.update.sql b/SQL/sqlite.update.sql
index accf64a73..26dc00f4f 100644
--- a/SQL/sqlite.update.sql
+++ b/SQL/sqlite.update.sql
@@ -29,3 +29,7 @@ CREATE INDEX ix_users_alias ON users(alias);
-- Updates from version 0.2-alpha
CREATE INDEX ix_messages_created ON messages (created);
+
+-- Updates from version 0.2-beta
+
+CREATE INDEX ix_session_changed ON session (changed);