25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

Remove unnecessary indexes

For columns are already included in a compound index there is no
benefit to having a separate index with a subset of the same columns in
the same order, it just wastes space.
This commit is contained in:
Stu Tomlinson 2022-11-22 12:15:35 +00:00
parent 93bf4d5411
commit 06ffe995e1
9 changed files with 6 additions and 108 deletions

View File

@ -52,7 +52,6 @@ CREATE TABLE rosterusers (
); );
CREATE UNIQUE INDEX i_rosteru_sh_user_jid ON rosterusers (server_host, username, jid); CREATE UNIQUE INDEX i_rosteru_sh_user_jid ON rosterusers (server_host, username, jid);
CREATE INDEX i_rosteru_sh_username ON rosterusers (server_host, username);
CREATE INDEX i_rosteru_sh_jid ON rosterusers (server_host, jid); CREATE INDEX i_rosteru_sh_jid ON rosterusers (server_host, jid);
@ -84,7 +83,6 @@ CREATE TABLE sr_user (
); );
CREATE UNIQUE INDEX i_sr_user_sh_jid_grp ON sr_user (server_host, jid, grp); CREATE UNIQUE INDEX i_sr_user_sh_jid_grp ON sr_user (server_host, jid, grp);
CREATE INDEX i_sr_user_sh_jid ON sr_user (server_host, jid);
CREATE INDEX i_sr_user_sh_grp ON sr_user (server_host, grp); CREATE INDEX i_sr_user_sh_grp ON sr_user (server_host, grp);
CREATE TABLE spool ( CREATE TABLE spool (
@ -190,7 +188,6 @@ CREATE TABLE privacy_list (
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
); );
CREATE INDEX i_privacy_list_sh_username ON privacy_list (server_host, username);
CREATE UNIQUE INDEX i_privacy_list_sh_username_name ON privacy_list (server_host, username, name); CREATE UNIQUE INDEX i_privacy_list_sh_username_name ON privacy_list (server_host, username, name);
CREATE TABLE privacy_list_data ( CREATE TABLE privacy_list_data (
@ -215,9 +212,6 @@ CREATE TABLE private_storage (
PRIMARY KEY (server_host, username, namespace) PRIMARY KEY (server_host, username, namespace)
); );
CREATE INDEX i_private_storage_sh_username ON private_storage (server_host, username);
CREATE TABLE roster_version ( CREATE TABLE roster_version (
username text NOT NULL, username text NOT NULL,
server_host text NOT NULL, server_host text NOT NULL,
@ -319,7 +313,6 @@ CREATE TABLE muc_online_users (
); );
CREATE UNIQUE INDEX i_muc_online_users ON muc_online_users (username, server, resource, name, host); CREATE UNIQUE INDEX i_muc_online_users ON muc_online_users (username, server, resource, name, host);
CREATE INDEX i_muc_online_users_us ON muc_online_users (username, server);
CREATE TABLE muc_room_subscribers ( CREATE TABLE muc_room_subscribers (
room text NOT NULL, room text NOT NULL,
@ -389,7 +382,6 @@ CREATE TABLE route (
); );
CREATE UNIQUE INDEX i_route ON route(domain, server_host, node, pid); CREATE UNIQUE INDEX i_route ON route(domain, server_host, node, pid);
CREATE INDEX i_route_domain ON route(domain);
CREATE TABLE bosh ( CREATE TABLE bosh (
sid text NOT NULL, sid text NOT NULL,
@ -449,7 +441,6 @@ CREATE TABLE mix_participant (
); );
CREATE UNIQUE INDEX i_mix_participant ON mix_participant (channel, service, username, domain); CREATE UNIQUE INDEX i_mix_participant ON mix_participant (channel, service, username, domain);
CREATE INDEX i_mix_participant_chan_serv ON mix_participant (channel, service);
CREATE TABLE mix_subscription ( CREATE TABLE mix_subscription (
channel text NOT NULL, channel text NOT NULL,
@ -461,9 +452,7 @@ CREATE TABLE mix_subscription (
); );
CREATE UNIQUE INDEX i_mix_subscription ON mix_subscription (channel, service, username, domain, node); CREATE UNIQUE INDEX i_mix_subscription ON mix_subscription (channel, service, username, domain, node);
CREATE INDEX i_mix_subscription_chan_serv_ud ON mix_subscription (channel, service, username, domain);
CREATE INDEX i_mix_subscription_chan_serv_node ON mix_subscription (channel, service, node); CREATE INDEX i_mix_subscription_chan_serv_node ON mix_subscription (channel, service, node);
CREATE INDEX i_mix_subscription_chan_serv ON mix_subscription (channel, service);
CREATE TABLE mix_pam ( CREATE TABLE mix_pam (
username text NOT NULL, username text NOT NULL,
@ -475,7 +464,6 @@ CREATE TABLE mix_pam (
); );
CREATE UNIQUE INDEX i_mix_pam ON mix_pam (username, server_host, channel, service); CREATE UNIQUE INDEX i_mix_pam ON mix_pam (username, server_host, channel, service);
CREATE INDEX i_mix_pam_us ON mix_pam (username, server_host);
CREATE TABLE mqtt_pub ( CREATE TABLE mqtt_pub (
username text NOT NULL, username text NOT NULL,

View File

@ -47,7 +47,6 @@ CREATE TABLE rosterusers (
); );
CREATE UNIQUE INDEX i_rosteru_user_jid ON rosterusers (username, jid); CREATE UNIQUE INDEX i_rosteru_user_jid ON rosterusers (username, jid);
CREATE INDEX i_rosteru_username ON rosterusers (username);
CREATE INDEX i_rosteru_jid ON rosterusers (jid); CREATE INDEX i_rosteru_jid ON rosterusers (jid);
@ -74,7 +73,6 @@ CREATE TABLE sr_user (
); );
CREATE UNIQUE INDEX i_sr_user_jid_grp ON sr_user (jid, grp); CREATE UNIQUE INDEX i_sr_user_jid_grp ON sr_user (jid, grp);
CREATE INDEX i_sr_user_jid ON sr_user (jid);
CREATE INDEX i_sr_user_grp ON sr_user (grp); CREATE INDEX i_sr_user_grp ON sr_user (grp);
CREATE TABLE spool ( CREATE TABLE spool (
@ -169,7 +167,6 @@ CREATE TABLE privacy_list (
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
); );
CREATE INDEX i_privacy_list_username ON privacy_list (username);
CREATE UNIQUE INDEX i_privacy_list_username_name ON privacy_list (username, name); CREATE UNIQUE INDEX i_privacy_list_username_name ON privacy_list (username, name);
CREATE TABLE privacy_list_data ( CREATE TABLE privacy_list_data (
@ -192,7 +189,6 @@ CREATE TABLE private_storage (
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
); );
CREATE INDEX i_private_storage_username ON private_storage (username);
CREATE UNIQUE INDEX i_private_storage_username_namespace ON private_storage (username, namespace); CREATE UNIQUE INDEX i_private_storage_username_namespace ON private_storage (username, namespace);
@ -291,7 +287,6 @@ CREATE TABLE muc_online_users (
); );
CREATE UNIQUE INDEX i_muc_online_users ON muc_online_users (username, server, resource, name, host); CREATE UNIQUE INDEX i_muc_online_users ON muc_online_users (username, server, resource, name, host);
CREATE INDEX i_muc_online_users_us ON muc_online_users (username, server);
CREATE TABLE muc_room_subscribers ( CREATE TABLE muc_room_subscribers (
room text NOT NULL, room text NOT NULL,
@ -358,7 +353,6 @@ CREATE TABLE route (
); );
CREATE UNIQUE INDEX i_route ON route(domain, server_host, node, pid); CREATE UNIQUE INDEX i_route ON route(domain, server_host, node, pid);
CREATE INDEX i_route_domain ON route(domain);
CREATE TABLE bosh ( CREATE TABLE bosh (
sid text NOT NULL, sid text NOT NULL,
@ -417,7 +411,6 @@ CREATE TABLE mix_participant (
); );
CREATE UNIQUE INDEX i_mix_participant ON mix_participant (channel, service, username, domain); CREATE UNIQUE INDEX i_mix_participant ON mix_participant (channel, service, username, domain);
CREATE INDEX i_mix_participant_chan_serv ON mix_participant (channel, service);
CREATE TABLE mix_subscription ( CREATE TABLE mix_subscription (
channel text NOT NULL, channel text NOT NULL,
@ -429,9 +422,7 @@ CREATE TABLE mix_subscription (
); );
CREATE UNIQUE INDEX i_mix_subscription ON mix_subscription (channel, service, username, domain, node); CREATE UNIQUE INDEX i_mix_subscription ON mix_subscription (channel, service, username, domain, node);
CREATE INDEX i_mix_subscription_chan_serv_ud ON mix_subscription (channel, service, username, domain);
CREATE INDEX i_mix_subscription_chan_serv_node ON mix_subscription (channel, service, node); CREATE INDEX i_mix_subscription_chan_serv_node ON mix_subscription (channel, service, node);
CREATE INDEX i_mix_subscription_chan_serv ON mix_subscription (channel, service);
CREATE TABLE mix_pam ( CREATE TABLE mix_pam (
username text NOT NULL, username text NOT NULL,
@ -442,7 +433,6 @@ CREATE TABLE mix_pam (
); );
CREATE UNIQUE INDEX i_mix_pam ON mix_pam (username, channel, service); CREATE UNIQUE INDEX i_mix_pam ON mix_pam (username, channel, service);
CREATE INDEX i_mix_pam_us ON mix_pam (username);
CREATE TABLE mqtt_pub ( CREATE TABLE mqtt_pub (
username text NOT NULL, username text NOT NULL,

View File

@ -138,8 +138,6 @@ CREATE TABLE [dbo].[muc_online_users] (
CREATE UNIQUE INDEX [muc_online_users_i] ON [muc_online_users] (username, server, resource, name, host) CREATE UNIQUE INDEX [muc_online_users_i] ON [muc_online_users] (username, server, resource, name, host)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON); WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
CREATE UNIQUE CLUSTERED INDEX [muc_online_users_us] ON [muc_online_users] (username, server)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
CREATE TABLE [dbo].[muc_room_subscribers] ( CREATE TABLE [dbo].[muc_room_subscribers] (
[room] [varchar] (191) NOT NULL, [room] [varchar] (191) NOT NULL,
@ -174,9 +172,6 @@ CREATE TABLE [dbo].[privacy_list] (
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
); );
CREATE INDEX [privacy_list_username] ON [privacy_list] (username)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
CREATE UNIQUE INDEX [privacy_list_username_name] ON [privacy_list] (username, name) CREATE UNIQUE INDEX [privacy_list_username_name] ON [privacy_list] (username, name)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON); WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
@ -203,9 +198,6 @@ CREATE TABLE [dbo].[private_storage] (
[created_at] [datetime] NOT NULL DEFAULT GETDATE() [created_at] [datetime] NOT NULL DEFAULT GETDATE()
) TEXTIMAGE_ON [PRIMARY]; ) TEXTIMAGE_ON [PRIMARY];
CREATE INDEX [private_storage_username] ON [private_storage] (username)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
CREATE UNIQUE CLUSTERED INDEX [private_storage_username_namespace] ON [private_storage] (username, namespace) CREATE UNIQUE CLUSTERED INDEX [private_storage_username_namespace] ON [private_storage] (username, namespace)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON); WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
@ -320,9 +312,6 @@ CREATE TABLE [dbo].[rosterusers] (
CREATE UNIQUE CLUSTERED INDEX [rosterusers_username_jid] ON [rosterusers] ([username], [jid]) CREATE UNIQUE CLUSTERED INDEX [rosterusers_username_jid] ON [rosterusers] ([username], [jid])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON); WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
CREATE INDEX [rosterusers_username] ON [rosterusers] ([username])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
CREATE INDEX [rosterusers_jid] ON [rosterusers] ([jid]) CREATE INDEX [rosterusers_jid] ON [rosterusers] ([jid])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON); WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
@ -381,9 +370,6 @@ CREATE TABLE [dbo].[sr_user] (
CREATE UNIQUE CLUSTERED INDEX [sr_user_jid_group] ON [sr_user] ([jid], [grp]) CREATE UNIQUE CLUSTERED INDEX [sr_user_jid_group] ON [sr_user] ([jid], [grp])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON); WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
CREATE INDEX [sr_user_jid] ON [sr_user] ([jid])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
CREATE INDEX [sr_user_grp] ON [sr_user] ([grp]) CREATE INDEX [sr_user_grp] ON [sr_user] ([grp])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON); WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
@ -520,9 +506,6 @@ CREATE TABLE [dbo].[route] (
CREATE UNIQUE CLUSTERED INDEX [route_i] ON [route] (domain, server_host, node, pid) CREATE UNIQUE CLUSTERED INDEX [route_i] ON [route] (domain, server_host, node, pid)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON); WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
CREATE INDEX [route_domain] ON [route] (domain)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON);
CREATE TABLE [dbo].[bosh] ( CREATE TABLE [dbo].[bosh] (
[sid] [varchar] (255) NOT NULL, [sid] [varchar] (255) NOT NULL,
[node] [varchar] (255) NOT NULL, [node] [varchar] (255) NOT NULL,

View File

@ -56,7 +56,6 @@ CREATE TABLE rosterusers (
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE UNIQUE INDEX i_rosteru_sh_user_jid ON rosterusers(server_host(191), username(75), jid(75)); CREATE UNIQUE INDEX i_rosteru_sh_user_jid ON rosterusers(server_host(191), username(75), jid(75));
CREATE INDEX i_rosteru_sh_username ON rosterusers(server_host(191), username);
CREATE INDEX i_rosteru_sh_jid ON rosterusers(server_host(191), jid); CREATE INDEX i_rosteru_sh_jid ON rosterusers(server_host(191), jid);
CREATE TABLE rostergroups ( CREATE TABLE rostergroups (
@ -87,7 +86,6 @@ CREATE TABLE sr_user (
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE UNIQUE INDEX i_sr_user_sh_jid_group ON sr_user(server_host(191), jid, grp); CREATE UNIQUE INDEX i_sr_user_sh_jid_group ON sr_user(server_host(191), jid, grp);
CREATE INDEX i_sr_user_sh_jid ON sr_user(server_host(191), jid);
CREATE INDEX i_sr_user_sh_grp ON sr_user(server_host(191), grp); CREATE INDEX i_sr_user_sh_grp ON sr_user(server_host(191), grp);
CREATE TABLE spool ( CREATE TABLE spool (
@ -195,7 +193,6 @@ CREATE TABLE privacy_list (
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE INDEX i_privacy_list_sh_username USING BTREE ON privacy_list(server_host(191), username);
CREATE UNIQUE INDEX i_privacy_list_sh_username_name USING BTREE ON privacy_list (server_host(191), username(75), name(75)); CREATE UNIQUE INDEX i_privacy_list_sh_username_name USING BTREE ON privacy_list (server_host(191), username(75), name(75));
CREATE TABLE privacy_list_data ( CREATE TABLE privacy_list_data (
@ -218,11 +215,10 @@ CREATE TABLE private_storage (
server_host varchar(191) NOT NULL, server_host varchar(191) NOT NULL,
namespace varchar(191) NOT NULL, namespace varchar(191) NOT NULL,
data text NOT NULL, data text NOT NULL,
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
PRIMARY KEY (server_host(191), username, namespace)
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE INDEX i_private_storage_sh_username USING BTREE ON private_storage(server_host(191), username); CREATE UNIQUE INDEX i_private_storage_sh_sername_namespace USING BTREE ON private_storage(server_host(191), username, namespace);
-- Not tested in mysql -- Not tested in mysql
CREATE TABLE roster_version ( CREATE TABLE roster_version (
@ -335,7 +331,6 @@ CREATE TABLE muc_online_users (
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE UNIQUE INDEX i_muc_online_users USING BTREE ON muc_online_users(username(75), server(75), resource(75), name(75), host(75)); CREATE UNIQUE INDEX i_muc_online_users USING BTREE ON muc_online_users(username(75), server(75), resource(75), name(75), host(75));
CREATE INDEX i_muc_online_users_us USING BTREE ON muc_online_users(username(75), server(75));
CREATE TABLE muc_room_subscribers ( CREATE TABLE muc_room_subscribers (
room varchar(191) NOT NULL, room varchar(191) NOT NULL,
@ -405,7 +400,6 @@ CREATE TABLE route (
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE UNIQUE INDEX i_route ON route(domain(75), server_host(75), node(75), pid(75)); CREATE UNIQUE INDEX i_route ON route(domain(75), server_host(75), node(75), pid(75));
CREATE INDEX i_route_domain ON route(domain(75));
CREATE TABLE bosh ( CREATE TABLE bosh (
sid text NOT NULL, sid text NOT NULL,
@ -465,7 +459,6 @@ CREATE TABLE mix_participant (
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE UNIQUE INDEX i_mix_participant ON mix_participant (channel(191), service(191), username(191), domain(191)); CREATE UNIQUE INDEX i_mix_participant ON mix_participant (channel(191), service(191), username(191), domain(191));
CREATE INDEX i_mix_participant_chan_serv ON mix_participant (channel(191), service(191));
CREATE TABLE mix_subscription ( CREATE TABLE mix_subscription (
channel text NOT NULL, channel text NOT NULL,
@ -477,9 +470,7 @@ CREATE TABLE mix_subscription (
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE UNIQUE INDEX i_mix_subscription ON mix_subscription (channel(153), service(153), username(153), domain(153), node(153)); CREATE UNIQUE INDEX i_mix_subscription ON mix_subscription (channel(153), service(153), username(153), domain(153), node(153));
CREATE INDEX i_mix_subscription_chan_serv_ud ON mix_subscription (channel(191), service(191), username(191), domain(191));
CREATE INDEX i_mix_subscription_chan_serv_node ON mix_subscription (channel(191), service(191), node(191)); CREATE INDEX i_mix_subscription_chan_serv_node ON mix_subscription (channel(191), service(191), node(191));
CREATE INDEX i_mix_subscription_chan_serv ON mix_subscription (channel(191), service(191));
CREATE TABLE mix_pam ( CREATE TABLE mix_pam (
username text NOT NULL, username text NOT NULL,
@ -491,7 +482,6 @@ CREATE TABLE mix_pam (
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE UNIQUE INDEX i_mix_pam ON mix_pam (username(191), server_host(191), channel(191), service(191)); CREATE UNIQUE INDEX i_mix_pam ON mix_pam (username(191), server_host(191), channel(191), service(191));
CREATE INDEX i_mix_pam_us ON mix_pam (username(191), server_host(191));
CREATE TABLE mqtt_pub ( CREATE TABLE mqtt_pub (
username varchar(191) NOT NULL, username varchar(191) NOT NULL,

View File

@ -33,14 +33,12 @@ BEGIN
ALTER TABLE `rosterusers` ADD COLUMN `server_host` VARCHAR (191) COLLATE `utf8mb4_unicode_ci` NOT NULL DEFAULT @DEFAULT_HOST AFTER `username`; ALTER TABLE `rosterusers` ADD COLUMN `server_host` VARCHAR (191) COLLATE `utf8mb4_unicode_ci` NOT NULL DEFAULT @DEFAULT_HOST AFTER `username`;
ALTER TABLE `rosterusers` ALTER COLUMN `server_host` DROP DEFAULT; ALTER TABLE `rosterusers` ALTER COLUMN `server_host` DROP DEFAULT;
ALTER TABLE `rosterusers` ADD UNIQUE INDEX `i_rosteru_sh_user_jid` (`server_host`, `username`(75), `jid`(75)); ALTER TABLE `rosterusers` ADD UNIQUE INDEX `i_rosteru_sh_user_jid` (`server_host`, `username`(75), `jid`(75));
ALTER TABLE `rosterusers` ADD INDEX `i_rosteru_sh_username` (`server_host`, `username`);
ALTER TABLE `rosterusers` ADD INDEX `i_rosteru_sh_jid` (`server_host`, `jid`); ALTER TABLE `rosterusers` ADD INDEX `i_rosteru_sh_jid` (`server_host`, `jid`);
ALTER TABLE `private_storage` DROP INDEX `i_private_storage_username_namespace`; ALTER TABLE `private_storage` DROP INDEX `i_private_storage_username_namespace`;
ALTER TABLE `private_storage` DROP INDEX `i_private_storage_username`; ALTER TABLE `private_storage` DROP INDEX `i_private_storage_username`;
ALTER TABLE `private_storage` ADD COLUMN `server_host` VARCHAR (191) COLLATE `utf8mb4_unicode_ci` NOT NULL DEFAULT @DEFAULT_HOST AFTER `username`; ALTER TABLE `private_storage` ADD COLUMN `server_host` VARCHAR (191) COLLATE `utf8mb4_unicode_ci` NOT NULL DEFAULT @DEFAULT_HOST AFTER `username`;
ALTER TABLE `private_storage` ALTER COLUMN `server_host` DROP DEFAULT; ALTER TABLE `private_storage` ALTER COLUMN `server_host` DROP DEFAULT;
ALTER TABLE `private_storage` ADD PRIMARY KEY (`server_host`, `username`, `namespace`); ALTER TABLE `private_storage` ADD PRIMARY KEY (`server_host`, `username`, `namespace`);
ALTER TABLE `private_storage` ADD INDEX `i_private_storage_sh_username` USING BTREE (`server_host`, `username`);
ALTER TABLE `mqtt_pub` DROP INDEX `i_mqtt_topic`; ALTER TABLE `mqtt_pub` DROP INDEX `i_mqtt_topic`;
ALTER TABLE `mqtt_pub` ADD COLUMN `server_host` VARCHAR (191) NOT NULL DEFAULT @DEFAULT_HOST AFTER `username`; ALTER TABLE `mqtt_pub` ADD COLUMN `server_host` VARCHAR (191) NOT NULL DEFAULT @DEFAULT_HOST AFTER `username`;
ALTER TABLE `mqtt_pub` ALTER COLUMN `server_host` DROP DEFAULT; ALTER TABLE `mqtt_pub` ALTER COLUMN `server_host` DROP DEFAULT;
@ -94,14 +92,12 @@ BEGIN
ALTER TABLE `privacy_list` ADD COLUMN `server_host` VARCHAR (191) COLLATE `utf8mb4_unicode_ci` NOT NULL DEFAULT @DEFAULT_HOST AFTER `username`; ALTER TABLE `privacy_list` ADD COLUMN `server_host` VARCHAR (191) COLLATE `utf8mb4_unicode_ci` NOT NULL DEFAULT @DEFAULT_HOST AFTER `username`;
ALTER TABLE `privacy_list` ALTER COLUMN `server_host` DROP DEFAULT; ALTER TABLE `privacy_list` ALTER COLUMN `server_host` DROP DEFAULT;
ALTER TABLE `privacy_list` ADD UNIQUE INDEX `i_privacy_list_sh_username_name` USING BTREE (`server_host`, `username`(75), `name`(75)); ALTER TABLE `privacy_list` ADD UNIQUE INDEX `i_privacy_list_sh_username_name` USING BTREE (`server_host`, `username`(75), `name`(75));
ALTER TABLE `privacy_list` ADD INDEX `i_privacy_list_sh_username` USING BTREE (`server_host`, `username`);
ALTER TABLE `sr_user` DROP INDEX `i_sr_user_jid`; ALTER TABLE `sr_user` DROP INDEX `i_sr_user_jid`;
ALTER TABLE `sr_user` DROP INDEX `i_sr_user_grp`; ALTER TABLE `sr_user` DROP INDEX `i_sr_user_grp`;
ALTER TABLE `sr_user` DROP INDEX `i_sr_user_jid_group`; ALTER TABLE `sr_user` DROP INDEX `i_sr_user_jid_group`;
ALTER TABLE `sr_user` ADD COLUMN `server_host` VARCHAR (191) COLLATE `utf8mb4_unicode_ci` NOT NULL DEFAULT @DEFAULT_HOST AFTER `jid`; ALTER TABLE `sr_user` ADD COLUMN `server_host` VARCHAR (191) COLLATE `utf8mb4_unicode_ci` NOT NULL DEFAULT @DEFAULT_HOST AFTER `jid`;
ALTER TABLE `sr_user` ALTER COLUMN `server_host` DROP DEFAULT; ALTER TABLE `sr_user` ALTER COLUMN `server_host` DROP DEFAULT;
ALTER TABLE `sr_user` ADD UNIQUE INDEX `i_sr_user_sh_jid_group` (`server_host`, `jid`, `grp`); ALTER TABLE `sr_user` ADD UNIQUE INDEX `i_sr_user_sh_jid_group` (`server_host`, `jid`, `grp`);
ALTER TABLE `sr_user` ADD INDEX `i_sr_user_sh_jid` (`server_host`, `jid`);
ALTER TABLE `sr_user` ADD INDEX `i_sr_user_sh_grp` (`server_host`, `grp`); ALTER TABLE `sr_user` ADD INDEX `i_sr_user_sh_grp` (`server_host`, `grp`);
ALTER TABLE `sr_user` ADD PRIMARY KEY (`server_host`, `jid`, `grp`); ALTER TABLE `sr_user` ADD PRIMARY KEY (`server_host`, `jid`, `grp`);
ALTER TABLE `muc_online_users` ADD COLUMN `server_host` VARCHAR (191) COLLATE `utf8mb4_unicode_ci` NOT NULL DEFAULT @DEFAULT_HOST AFTER `host`; ALTER TABLE `muc_online_users` ADD COLUMN `server_host` VARCHAR (191) COLLATE `utf8mb4_unicode_ci` NOT NULL DEFAULT @DEFAULT_HOST AFTER `host`;
@ -119,7 +115,6 @@ BEGIN
ALTER TABLE `mix_pam` ADD COLUMN `server_host` VARCHAR (191) COLLATE `utf8mb4_unicode_ci` NOT NULL DEFAULT @DEFAULT_HOST AFTER `username`; ALTER TABLE `mix_pam` ADD COLUMN `server_host` VARCHAR (191) COLLATE `utf8mb4_unicode_ci` NOT NULL DEFAULT @DEFAULT_HOST AFTER `username`;
ALTER TABLE `mix_pam` ALTER COLUMN `server_host` DROP DEFAULT; ALTER TABLE `mix_pam` ALTER COLUMN `server_host` DROP DEFAULT;
ALTER TABLE `mix_pam` ADD UNIQUE INDEX `i_mix_pam` (`username`(191), `server_host`, `channel`(191), `service`(191)); ALTER TABLE `mix_pam` ADD UNIQUE INDEX `i_mix_pam` (`username`(191), `server_host`, `channel`(191), `service`(191));
ALTER TABLE `mix_pam` ADD INDEX `i_mix_pam_us` (`username`(191), `server_host`);
ALTER TABLE `route` CHANGE COLUMN `server_host` `server_host` VARCHAR (191) COLLATE `utf8mb4_unicode_ci` NOT NULL; ALTER TABLE `route` CHANGE COLUMN `server_host` `server_host` VARCHAR (191) COLLATE `utf8mb4_unicode_ci` NOT NULL;
ALTER TABLE `users` DROP PRIMARY KEY; ALTER TABLE `users` DROP PRIMARY KEY;
ALTER TABLE `users` ADD COLUMN `server_host` VARCHAR (191) COLLATE `utf8mb4_unicode_ci` NOT NULL DEFAULT @DEFAULT_HOST AFTER `username`; ALTER TABLE `users` ADD COLUMN `server_host` VARCHAR (191) COLLATE `utf8mb4_unicode_ci` NOT NULL DEFAULT @DEFAULT_HOST AFTER `username`;

View File

@ -51,7 +51,6 @@ CREATE TABLE rosterusers (
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE UNIQUE INDEX i_rosteru_user_jid ON rosterusers(username(75), jid(75)); CREATE UNIQUE INDEX i_rosteru_user_jid ON rosterusers(username(75), jid(75));
CREATE INDEX i_rosteru_username ON rosterusers(username);
CREATE INDEX i_rosteru_jid ON rosterusers(jid); CREATE INDEX i_rosteru_jid ON rosterusers(jid);
CREATE TABLE rostergroups ( CREATE TABLE rostergroups (
@ -77,7 +76,6 @@ CREATE TABLE sr_user (
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE UNIQUE INDEX i_sr_user_jid_group ON sr_user(jid(75), grp(75)); CREATE UNIQUE INDEX i_sr_user_jid_group ON sr_user(jid(75), grp(75));
CREATE INDEX i_sr_user_jid ON sr_user(jid);
CREATE INDEX i_sr_user_grp ON sr_user(grp); CREATE INDEX i_sr_user_grp ON sr_user(grp);
CREATE TABLE spool ( CREATE TABLE spool (
@ -174,7 +172,6 @@ CREATE TABLE privacy_list (
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE INDEX i_privacy_list_username USING BTREE ON privacy_list(username);
CREATE UNIQUE INDEX i_privacy_list_username_name USING BTREE ON privacy_list (username(75), name(75)); CREATE UNIQUE INDEX i_privacy_list_username_name USING BTREE ON privacy_list (username(75), name(75));
CREATE TABLE privacy_list_data ( CREATE TABLE privacy_list_data (
@ -199,7 +196,6 @@ CREATE TABLE private_storage (
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE INDEX i_private_storage_username USING BTREE ON private_storage(username);
CREATE UNIQUE INDEX i_private_storage_username_namespace USING BTREE ON private_storage(username(75), namespace(75)); CREATE UNIQUE INDEX i_private_storage_username_namespace USING BTREE ON private_storage(username(75), namespace(75));
-- Not tested in mysql -- Not tested in mysql
@ -307,7 +303,6 @@ CREATE TABLE muc_online_users (
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE UNIQUE INDEX i_muc_online_users USING BTREE ON muc_online_users(username(75), server(75), resource(75), name(75), host(75)); CREATE UNIQUE INDEX i_muc_online_users USING BTREE ON muc_online_users(username(75), server(75), resource(75), name(75), host(75));
CREATE INDEX i_muc_online_users_us USING BTREE ON muc_online_users(username(75), server(75));
CREATE TABLE muc_room_subscribers ( CREATE TABLE muc_room_subscribers (
room varchar(191) NOT NULL, room varchar(191) NOT NULL,
@ -374,7 +369,6 @@ CREATE TABLE route (
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE UNIQUE INDEX i_route ON route(domain(75), server_host(75), node(75), pid(75)); CREATE UNIQUE INDEX i_route ON route(domain(75), server_host(75), node(75), pid(75));
CREATE INDEX i_route_domain ON route(domain(75));
CREATE TABLE bosh ( CREATE TABLE bosh (
sid text NOT NULL, sid text NOT NULL,
@ -433,7 +427,6 @@ CREATE TABLE mix_participant (
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE UNIQUE INDEX i_mix_participant ON mix_participant (channel(191), service(191), username(191), domain(191)); CREATE UNIQUE INDEX i_mix_participant ON mix_participant (channel(191), service(191), username(191), domain(191));
CREATE INDEX i_mix_participant_chan_serv ON mix_participant (channel(191), service(191));
CREATE TABLE mix_subscription ( CREATE TABLE mix_subscription (
channel text NOT NULL, channel text NOT NULL,
@ -445,9 +438,7 @@ CREATE TABLE mix_subscription (
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE UNIQUE INDEX i_mix_subscription ON mix_subscription (channel(153), service(153), username(153), domain(153), node(153)); CREATE UNIQUE INDEX i_mix_subscription ON mix_subscription (channel(153), service(153), username(153), domain(153), node(153));
CREATE INDEX i_mix_subscription_chan_serv_ud ON mix_subscription (channel(191), service(191), username(191), domain(191));
CREATE INDEX i_mix_subscription_chan_serv_node ON mix_subscription (channel(191), service(191), node(191)); CREATE INDEX i_mix_subscription_chan_serv_node ON mix_subscription (channel(191), service(191), node(191));
CREATE INDEX i_mix_subscription_chan_serv ON mix_subscription (channel(191), service(191));
CREATE TABLE mix_pam ( CREATE TABLE mix_pam (
username text NOT NULL, username text NOT NULL,
@ -458,7 +449,6 @@ CREATE TABLE mix_pam (
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE UNIQUE INDEX i_mix_pam ON mix_pam (username(191), channel(191), service(191)); CREATE UNIQUE INDEX i_mix_pam ON mix_pam (username(191), channel(191), service(191));
CREATE INDEX i_mix_pam_u ON mix_pam (username(191));
CREATE TABLE mqtt_pub ( CREATE TABLE mqtt_pub (
username varchar(191) NOT NULL, username varchar(191) NOT NULL,

View File

@ -30,10 +30,8 @@
-- ALTER TABLE rosterusers ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>'; -- ALTER TABLE rosterusers ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>';
-- DROP INDEX i_rosteru_user_jid; -- DROP INDEX i_rosteru_user_jid;
-- DROP INDEX i_rosteru_username;
-- DROP INDEX i_rosteru_jid; -- DROP INDEX i_rosteru_jid;
-- CREATE UNIQUE INDEX i_rosteru_sh_user_jid ON rosterusers USING btree (server_host, username, jid); -- CREATE UNIQUE INDEX i_rosteru_sh_user_jid ON rosterusers USING btree (server_host, username, jid);
-- CREATE INDEX i_rosteru_sh_username ON rosterusers USING btree (server_host, username);
-- CREATE INDEX i_rosteru_sh_jid ON rosterusers USING btree (server_host, jid); -- CREATE INDEX i_rosteru_sh_jid ON rosterusers USING btree (server_host, jid);
-- ALTER TABLE rosterusers ALTER COLUMN server_host DROP DEFAULT; -- ALTER TABLE rosterusers ALTER COLUMN server_host DROP DEFAULT;
@ -48,10 +46,8 @@
-- ALTER TABLE sr_user ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>'; -- ALTER TABLE sr_user ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>';
-- DROP INDEX i_sr_user_jid_grp; -- DROP INDEX i_sr_user_jid_grp;
-- DROP INDEX i_sr_user_jid;
-- DROP INDEX i_sr_user_grp; -- DROP INDEX i_sr_user_grp;
-- ALTER TABLE sr_user ADD PRIMARY KEY (server_host, jid, grp); -- ALTER TABLE sr_user ADD PRIMARY KEY (server_host, jid, grp);
-- CREATE INDEX i_sr_user_sh_jid ON sr_user USING btree (server_host, jid);
-- CREATE INDEX i_sr_user_sh_grp ON sr_user USING btree (server_host, grp); -- CREATE INDEX i_sr_user_sh_grp ON sr_user USING btree (server_host, grp);
-- ALTER TABLE sr_user ALTER COLUMN server_host DROP DEFAULT; -- ALTER TABLE sr_user ALTER COLUMN server_host DROP DEFAULT;
@ -114,17 +110,13 @@
-- ALTER TABLE privacy_default_list ALTER COLUMN server_host DROP DEFAULT; -- ALTER TABLE privacy_default_list ALTER COLUMN server_host DROP DEFAULT;
-- ALTER TABLE privacy_list ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>'; -- ALTER TABLE privacy_list ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>';
-- DROP INDEX i_privacy_list_username;
-- DROP INDEX i_privacy_list_username_name; -- DROP INDEX i_privacy_list_username_name;
-- CREATE INDEX i_privacy_list_sh_username ON privacy_list USING btree (server_host, username);
-- CREATE UNIQUE INDEX i_privacy_list_sh_username_name ON privacy_list USING btree (server_host, username, name); -- CREATE UNIQUE INDEX i_privacy_list_sh_username_name ON privacy_list USING btree (server_host, username, name);
-- ALTER TABLE privacy_list ALTER COLUMN server_host DROP DEFAULT; -- ALTER TABLE privacy_list ALTER COLUMN server_host DROP DEFAULT;
-- ALTER TABLE private_storage ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>'; -- ALTER TABLE private_storage ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>';
-- DROP INDEX i_private_storage_username;
-- DROP INDEX i_private_storage_username_namespace; -- DROP INDEX i_private_storage_username_namespace;
-- ALTER TABLE private_storage ADD PRIMARY KEY (server_host, username, namespace); -- ALTER TABLE private_storage ADD PRIMARY KEY (server_host, username, namespace);
-- CREATE INDEX i_private_storage_sh_username ON private_storage USING btree (server_host, username);
-- ALTER TABLE private_storage ALTER COLUMN server_host DROP DEFAULT; -- ALTER TABLE private_storage ALTER COLUMN server_host DROP DEFAULT;
-- ALTER TABLE roster_version ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>'; -- ALTER TABLE roster_version ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>';
@ -165,9 +157,7 @@
-- ALTER TABLE mix_pam ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>'; -- ALTER TABLE mix_pam ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>';
-- DROP INDEX i_mix_pam; -- DROP INDEX i_mix_pam;
-- DROP INDEX i_mix_pam_us;
-- CREATE UNIQUE INDEX i_mix_pam ON mix_pam (username, server_host, channel, service); -- CREATE UNIQUE INDEX i_mix_pam ON mix_pam (username, server_host, channel, service);
-- CREATE INDEX i_mix_pam_us ON mix_pam (username, server_host);
-- ALTER TABLE mix_pam ALTER COLUMN server_host DROP DEFAULT; -- ALTER TABLE mix_pam ALTER COLUMN server_host DROP DEFAULT;
-- ALTER TABLE mqtt_pub ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>'; -- ALTER TABLE mqtt_pub ADD COLUMN server_host text NOT NULL DEFAULT '<HOST>';
@ -216,7 +206,6 @@ CREATE TABLE rosterusers (
); );
CREATE UNIQUE INDEX i_rosteru_sh_user_jid ON rosterusers USING btree (server_host, username, jid); CREATE UNIQUE INDEX i_rosteru_sh_user_jid ON rosterusers USING btree (server_host, username, jid);
CREATE INDEX i_rosteru_sh_username ON rosterusers USING btree (server_host, username);
CREATE INDEX i_rosteru_sh_jid ON rosterusers USING btree (server_host, jid); CREATE INDEX i_rosteru_sh_jid ON rosterusers USING btree (server_host, jid);
@ -233,8 +222,7 @@ CREATE TABLE sr_group (
name text NOT NULL, name text NOT NULL,
server_host text NOT NULL, server_host text NOT NULL,
opts text NOT NULL, opts text NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT now(), created_at TIMESTAMP NOT NULL DEFAULT now()
PRIMARY KEY (server_host, name)
); );
CREATE UNIQUE INDEX i_sr_group_sh_name ON sr_group USING btree (server_host, name); CREATE UNIQUE INDEX i_sr_group_sh_name ON sr_group USING btree (server_host, name);
@ -243,12 +231,10 @@ CREATE TABLE sr_user (
jid text NOT NULL, jid text NOT NULL,
server_host text NOT NULL, server_host text NOT NULL,
grp text NOT NULL, grp text NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT now(), created_at TIMESTAMP NOT NULL DEFAULT now()
PRIMARY KEY (server_host, jid, grp)
); );
CREATE UNIQUE INDEX i_sr_user_sh_jid_grp ON sr_user USING btree (server_host, jid, grp); CREATE UNIQUE INDEX i_sr_user_sh_jid_grp ON sr_user USING btree (server_host, jid, grp);
CREATE INDEX i_sr_user_sh_jid ON sr_user USING btree (server_host, jid);
CREATE INDEX i_sr_user_sh_grp ON sr_user USING btree (server_host, grp); CREATE INDEX i_sr_user_sh_grp ON sr_user USING btree (server_host, grp);
CREATE TABLE spool ( CREATE TABLE spool (
@ -354,7 +340,6 @@ CREATE TABLE privacy_list (
created_at TIMESTAMP NOT NULL DEFAULT now() created_at TIMESTAMP NOT NULL DEFAULT now()
); );
CREATE INDEX i_privacy_list_sh_username ON privacy_list USING btree (server_host, username);
CREATE UNIQUE INDEX i_privacy_list_sh_username_name ON privacy_list USING btree (server_host, username, name); CREATE UNIQUE INDEX i_privacy_list_sh_username_name ON privacy_list USING btree (server_host, username, name);
CREATE TABLE privacy_list_data ( CREATE TABLE privacy_list_data (
@ -377,12 +362,10 @@ CREATE TABLE private_storage (
server_host text NOT NULL, server_host text NOT NULL,
namespace text NOT NULL, namespace text NOT NULL,
data text NOT NULL, data text NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT now(), created_at TIMESTAMP NOT NULL DEFAULT now()
PRIMARY KEY (server_host, username, namespace)
); );
CREATE INDEX i_private_storage_sh_username ON private_storage USING btree (server_host, username); CREATE UNIQUE INDEX i_private_storage_sh_username_namespace ON private_storage USING btree (server_host, username, namespace);
CREATE TABLE roster_version ( CREATE TABLE roster_version (
username text NOT NULL, username text NOT NULL,
@ -497,7 +480,6 @@ CREATE TABLE muc_online_users (
); );
CREATE UNIQUE INDEX i_muc_online_users ON muc_online_users USING btree (username, server, resource, name, host); CREATE UNIQUE INDEX i_muc_online_users ON muc_online_users USING btree (username, server, resource, name, host);
CREATE INDEX i_muc_online_users_us ON muc_online_users USING btree (username, server);
CREATE TABLE muc_room_subscribers ( CREATE TABLE muc_room_subscribers (
room text NOT NULL, room text NOT NULL,
@ -569,7 +551,6 @@ CREATE TABLE route (
); );
CREATE UNIQUE INDEX i_route ON route USING btree (domain, server_host, node, pid); CREATE UNIQUE INDEX i_route ON route USING btree (domain, server_host, node, pid);
CREATE INDEX i_route_domain ON route USING btree (domain);
CREATE TABLE bosh ( CREATE TABLE bosh (
sid text NOT NULL, sid text NOT NULL,
@ -629,7 +610,6 @@ CREATE TABLE mix_participant (
); );
CREATE UNIQUE INDEX i_mix_participant ON mix_participant (channel, service, username, domain); CREATE UNIQUE INDEX i_mix_participant ON mix_participant (channel, service, username, domain);
CREATE INDEX i_mix_participant_chan_serv ON mix_participant (channel, service);
CREATE TABLE mix_subscription ( CREATE TABLE mix_subscription (
channel text NOT NULL, channel text NOT NULL,
@ -641,9 +621,7 @@ CREATE TABLE mix_subscription (
); );
CREATE UNIQUE INDEX i_mix_subscription ON mix_subscription (channel, service, username, domain, node); CREATE UNIQUE INDEX i_mix_subscription ON mix_subscription (channel, service, username, domain, node);
CREATE INDEX i_mix_subscription_chan_serv_ud ON mix_subscription (channel, service, username, domain);
CREATE INDEX i_mix_subscription_chan_serv_node ON mix_subscription (channel, service, node); CREATE INDEX i_mix_subscription_chan_serv_node ON mix_subscription (channel, service, node);
CREATE INDEX i_mix_subscription_chan_serv ON mix_subscription (channel, service);
CREATE TABLE mix_pam ( CREATE TABLE mix_pam (
username text NOT NULL, username text NOT NULL,
@ -655,7 +633,6 @@ CREATE TABLE mix_pam (
); );
CREATE UNIQUE INDEX i_mix_pam ON mix_pam (username, server_host, channel, service); CREATE UNIQUE INDEX i_mix_pam ON mix_pam (username, server_host, channel, service);
CREATE INDEX i_mix_pam_us ON mix_pam (username, server_host);
CREATE TABLE mqtt_pub ( CREATE TABLE mqtt_pub (
username text NOT NULL, username text NOT NULL,

View File

@ -51,7 +51,6 @@ CREATE TABLE rosterusers (
); );
CREATE UNIQUE INDEX i_rosteru_user_jid ON rosterusers USING btree (username, jid); CREATE UNIQUE INDEX i_rosteru_user_jid ON rosterusers USING btree (username, jid);
CREATE INDEX i_rosteru_username ON rosterusers USING btree (username);
CREATE INDEX i_rosteru_jid ON rosterusers USING btree (jid); CREATE INDEX i_rosteru_jid ON rosterusers USING btree (jid);
@ -78,7 +77,6 @@ CREATE TABLE sr_user (
); );
CREATE UNIQUE INDEX i_sr_user_jid_grp ON sr_user USING btree (jid, grp); CREATE UNIQUE INDEX i_sr_user_jid_grp ON sr_user USING btree (jid, grp);
CREATE INDEX i_sr_user_jid ON sr_user USING btree (jid);
CREATE INDEX i_sr_user_grp ON sr_user USING btree (grp); CREATE INDEX i_sr_user_grp ON sr_user USING btree (grp);
CREATE TABLE spool ( CREATE TABLE spool (
@ -173,7 +171,6 @@ CREATE TABLE privacy_list (
created_at TIMESTAMP NOT NULL DEFAULT now() created_at TIMESTAMP NOT NULL DEFAULT now()
); );
CREATE INDEX i_privacy_list_username ON privacy_list USING btree (username);
CREATE UNIQUE INDEX i_privacy_list_username_name ON privacy_list USING btree (username, name); CREATE UNIQUE INDEX i_privacy_list_username_name ON privacy_list USING btree (username, name);
CREATE TABLE privacy_list_data ( CREATE TABLE privacy_list_data (
@ -198,7 +195,6 @@ CREATE TABLE private_storage (
created_at TIMESTAMP NOT NULL DEFAULT now() created_at TIMESTAMP NOT NULL DEFAULT now()
); );
CREATE INDEX i_private_storage_username ON private_storage USING btree (username);
CREATE UNIQUE INDEX i_private_storage_username_namespace ON private_storage USING btree (username, namespace); CREATE UNIQUE INDEX i_private_storage_username_namespace ON private_storage USING btree (username, namespace);
@ -309,7 +305,6 @@ CREATE TABLE muc_online_users (
); );
CREATE UNIQUE INDEX i_muc_online_users ON muc_online_users USING btree (username, server, resource, name, host); CREATE UNIQUE INDEX i_muc_online_users ON muc_online_users USING btree (username, server, resource, name, host);
CREATE INDEX i_muc_online_users_us ON muc_online_users USING btree (username, server);
CREATE TABLE muc_room_subscribers ( CREATE TABLE muc_room_subscribers (
room text NOT NULL, room text NOT NULL,
@ -378,7 +373,6 @@ CREATE TABLE route (
); );
CREATE UNIQUE INDEX i_route ON route USING btree (domain, server_host, node, pid); CREATE UNIQUE INDEX i_route ON route USING btree (domain, server_host, node, pid);
CREATE INDEX i_route_domain ON route USING btree (domain);
CREATE TABLE bosh ( CREATE TABLE bosh (
sid text NOT NULL, sid text NOT NULL,
@ -437,7 +431,6 @@ CREATE TABLE mix_participant (
); );
CREATE UNIQUE INDEX i_mix_participant ON mix_participant (channel, service, username, domain); CREATE UNIQUE INDEX i_mix_participant ON mix_participant (channel, service, username, domain);
CREATE INDEX i_mix_participant_chan_serv ON mix_participant (channel, service);
CREATE TABLE mix_subscription ( CREATE TABLE mix_subscription (
channel text NOT NULL, channel text NOT NULL,
@ -449,9 +442,7 @@ CREATE TABLE mix_subscription (
); );
CREATE UNIQUE INDEX i_mix_subscription ON mix_subscription (channel, service, username, domain, node); CREATE UNIQUE INDEX i_mix_subscription ON mix_subscription (channel, service, username, domain, node);
CREATE INDEX i_mix_subscription_chan_serv_ud ON mix_subscription (channel, service, username, domain);
CREATE INDEX i_mix_subscription_chan_serv_node ON mix_subscription (channel, service, node); CREATE INDEX i_mix_subscription_chan_serv_node ON mix_subscription (channel, service, node);
CREATE INDEX i_mix_subscription_chan_serv ON mix_subscription (channel, service);
CREATE TABLE mix_pam ( CREATE TABLE mix_pam (
username text NOT NULL, username text NOT NULL,
@ -462,7 +453,6 @@ CREATE TABLE mix_pam (
); );
CREATE UNIQUE INDEX i_mix_pam ON mix_pam (username, channel, service); CREATE UNIQUE INDEX i_mix_pam ON mix_pam (username, channel, service);
CREATE INDEX i_mix_pam_us ON mix_pam (username);
CREATE TABLE mqtt_pub ( CREATE TABLE mqtt_pub (
username text NOT NULL, username text NOT NULL,

View File

@ -129,7 +129,6 @@ update_tables(State) ->
drop_index(State, "i_rosteru_username"), drop_index(State, "i_rosteru_username"),
drop_index(State, "i_rosteru_jid"), drop_index(State, "i_rosteru_jid"),
create_unique_index(State, "rosterusers", "i_rosteru_sh_user_jid", ["server_host", "username", "jid"]), create_unique_index(State, "rosterusers", "i_rosteru_sh_user_jid", ["server_host", "username", "jid"]),
create_index(State, "rosterusers", "i_rosteru_sh_username", ["server_host", "username"]),
create_index(State, "rosterusers", "i_rosteru_sh_jid", ["server_host", "jid"]), create_index(State, "rosterusers", "i_rosteru_sh_jid", ["server_host", "jid"]),
drop_sh_default(State, "rosterusers"), drop_sh_default(State, "rosterusers"),
@ -149,7 +148,6 @@ update_tables(State) ->
drop_index(State, "i_sr_user_grp"), drop_index(State, "i_sr_user_grp"),
add_pkey(State, "sr_user", ["server_host", "jid", "grp"]), add_pkey(State, "sr_user", ["server_host", "jid", "grp"]),
create_unique_index(State, "sr_user", "i_sr_user_sh_jid_grp", ["server_host", "jid", "grp"]), create_unique_index(State, "sr_user", "i_sr_user_sh_jid_grp", ["server_host", "jid", "grp"]),
create_index(State, "sr_user", "i_sr_user_sh_jid", ["server_host", "jid"]),
create_index(State, "sr_user", "i_sr_user_sh_grp", ["server_host", "grp"]), create_index(State, "sr_user", "i_sr_user_sh_grp", ["server_host", "grp"]),
drop_sh_default(State, "sr_user"), drop_sh_default(State, "sr_user"),
@ -217,7 +215,6 @@ update_tables(State) ->
add_sh_column(State, "privacy_list"), add_sh_column(State, "privacy_list"),
drop_index(State, "i_privacy_list_username"), drop_index(State, "i_privacy_list_username"),
drop_index(State, "i_privacy_list_username_name"), drop_index(State, "i_privacy_list_username_name"),
create_index(State, "privacy_list", "i_privacy_list_sh_username", ["server_host", "username"]),
create_unique_index(State, "privacy_list", "i_privacy_list_sh_username_name", ["server_host", "username", "name"]), create_unique_index(State, "privacy_list", "i_privacy_list_sh_username_name", ["server_host", "username", "name"]),
drop_sh_default(State, "privacy_list"), drop_sh_default(State, "privacy_list"),
@ -225,7 +222,6 @@ update_tables(State) ->
drop_index(State, "i_private_storage_username"), drop_index(State, "i_private_storage_username"),
drop_index(State, "i_private_storage_username_namespace"), drop_index(State, "i_private_storage_username_namespace"),
add_pkey(State, "private_storage", ["server_host", "username", "namespace"]), add_pkey(State, "private_storage", ["server_host", "username", "namespace"]),
create_index(State, "private_storage", "i_private_storage_sh_username", ["server_host", "username"]),
drop_sh_default(State, "private_storage"), drop_sh_default(State, "private_storage"),
add_sh_column(State, "roster_version"), add_sh_column(State, "roster_version"),
@ -268,7 +264,6 @@ update_tables(State) ->
drop_index(State, "i_mix_pam"), drop_index(State, "i_mix_pam"),
drop_index(State, "i_mix_pam_us"), drop_index(State, "i_mix_pam_us"),
create_unique_index(State, "mix_pam", "i_mix_pam", ["username", "server_host", "channel", "service"]), create_unique_index(State, "mix_pam", "i_mix_pam", ["username", "server_host", "channel", "service"]),
create_index(State, "mix_pam", "i_mix_pam_us", ["username", "server_host"]),
drop_sh_default(State, "mix_pam"), drop_sh_default(State, "mix_pam"),
add_sh_column(State, "mqtt_pub"), add_sh_column(State, "mqtt_pub"),