diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/lite.sql | 13 | ||||
-rw-r--r-- | sql/mssql.sql | 16 | ||||
-rw-r--r-- | sql/mysql.sql | 11 | ||||
-rw-r--r-- | sql/pg.sql | 13 |
4 files changed, 50 insertions, 3 deletions
diff --git a/sql/lite.sql b/sql/lite.sql index 1cc0c4dc5..44df0586d 100644 --- a/sql/lite.sql +++ b/sql/lite.sql @@ -97,7 +97,7 @@ CREATE TABLE archive ( created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ); -CREATE INDEX i_username ON archive(username); +CREATE INDEX i_username_timestamp ON archive(username, timestamp); CREATE INDEX i_timestamp ON archive(timestamp); CREATE INDEX i_peer ON archive(peer); CREATE INDEX i_bare_peer ON archive(bare_peer); @@ -375,3 +375,14 @@ CREATE TABLE proxy65 ( CREATE UNIQUE INDEX i_proxy65_sid ON proxy65 (sid); CREATE INDEX i_proxy65_jid ON proxy65 (jid_i); + +CREATE TABLE push_session ( + username text NOT NULL, + timestamp bigint NOT NULL, + service text NOT NULL, + node text NOT NULL, + xml text NOT NULL +); + +CREATE UNIQUE INDEX i_push_usn ON push_session (username, service, node); +CREATE UNIQUE INDEX i_push_ut ON push_session (username, timestamp); diff --git a/sql/mssql.sql b/sql/mssql.sql index 607acae8f..f49246ec3 100644 --- a/sql/mssql.sql +++ b/sql/mssql.sql @@ -38,7 +38,7 @@ CREATE TABLE [dbo].[archive] ( )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
) TEXTIMAGE_ON [PRIMARY];
-CREATE INDEX [archive_username] ON [archive] (username)
+CREATE INDEX [archive_username_timestamp] ON [archive] (username, timestamp)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
CREATE INDEX [archive_timestamp] ON [archive] (timestamp)
@@ -541,3 +541,17 @@ WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW CREATE INDEX [carboncopy_user] ON [carboncopy] (username)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
+
+CREATE TABLE [dbo].[push_session] (
+ [username] [varchar] (255) NOT NULL,
+ [timestamp] [bigint] NOT NULL,
+ [service] [varchar] (255) NOT NULL,
+ [node] [varchar] (255) NOT NULL,
+ [xml] [varchar] (255) NOT NULL
+);
+
+CREATE UNIQUE CLUSTERED INDEX [i_push_usn] ON [push_session] (username, service, node)
+WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
+
+CREATE UNIQUE CLUSTERED INDEX [i_push_ut] ON [push_session] (username, timestamp)
+WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
diff --git a/sql/mysql.sql b/sql/mysql.sql index e2586853b..4fd70f382 100644 --- a/sql/mysql.sql +++ b/sql/mysql.sql @@ -391,3 +391,14 @@ CREATE TABLE proxy65 ( CREATE UNIQUE INDEX i_proxy65_sid ON proxy65 (sid(191)); CREATE INDEX i_proxy65_jid ON proxy65 (jid_i(191)); + +CREATE TABLE push_session ( + username text NOT NULL, + timestamp bigint NOT NULL, + service text NOT NULL, + node text NOT NULL, + xml text NOT NULL +); + +CREATE UNIQUE INDEX i_push_usn ON push_session (username(191), service(191), node(191)); +CREATE UNIQUE INDEX i_push_ut ON push_session (username(191), timestamp); diff --git a/sql/pg.sql b/sql/pg.sql index f761e68da..db46111f5 100644 --- a/sql/pg.sql +++ b/sql/pg.sql @@ -101,7 +101,7 @@ CREATE TABLE archive ( created_at TIMESTAMP NOT NULL DEFAULT now() ); -CREATE INDEX i_username ON archive USING btree (username); +CREATE INDEX i_username_timestamp ON archive USING btree (username, timestamp); CREATE INDEX i_timestamp ON archive USING btree (timestamp); CREATE INDEX i_peer ON archive USING btree (peer); CREATE INDEX i_bare_peer ON archive USING btree (bare_peer); @@ -395,3 +395,14 @@ CREATE TABLE proxy65 ( CREATE UNIQUE INDEX i_proxy65_sid ON proxy65 USING btree (sid); CREATE INDEX i_proxy65_jid ON proxy65 USING btree (jid_i); + +CREATE TABLE push_session ( + username text NOT NULL, + timestamp bigint NOT NULL, + service text NOT NULL, + node text NOT NULL, + xml text NOT NULL +); + +CREATE UNIQUE INDEX i_push_usn ON push_session USING btree (username, service, node); +CREATE UNIQUE INDEX i_push_ut ON push_session USING btree (username, timestamp); |