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

Change type of server_host column in mysql.new.sql

Indexes are done only on 191 byte slice of that (to fit in index limits),
and since server_host could theoretically be bigger this causes mysql
engine don't use indexes in full potential.
This commit is contained in:
Paweł Chmielowski 2019-07-31 10:46:15 +02:00
parent bbee13f970
commit a2fa52a192

View File

@ -18,7 +18,7 @@
CREATE TABLE users (
username varchar(191) NOT NULL,
server_host text NOT NULL,
server_host varchar(191) NOT NULL,
password text NOT NULL,
serverkey varchar(64) NOT NULL DEFAULT '',
salt varchar(64) NOT NULL DEFAULT '',
@ -34,7 +34,7 @@ CREATE TABLE users (
CREATE TABLE last (
username varchar(191) NOT NULL,
server_host text NOT NULL,
server_host varchar(191) NOT NULL,
seconds text NOT NULL,
state text NOT NULL,
PRIMARY KEY (server_host(191), username)
@ -43,7 +43,7 @@ CREATE TABLE last (
CREATE TABLE rosterusers (
username varchar(191) NOT NULL,
server_host text NOT NULL,
server_host varchar(191) NOT NULL,
jid varchar(191) NOT NULL,
nick text NOT NULL,
subscription character(1) NOT NULL,
@ -61,7 +61,7 @@ CREATE INDEX i_rosteru_sh_jid ON rosterusers(server_host(191), jid);
CREATE TABLE rostergroups (
username varchar(191) NOT NULL,
server_host text NOT NULL,
server_host varchar(191) NOT NULL,
jid varchar(191) NOT NULL,
grp text NOT NULL
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
@ -70,7 +70,7 @@ CREATE INDEX i_rosterg_sh_user_jid ON rostergroups(server_host(191), username(75
CREATE TABLE sr_group (
name varchar(191) NOT NULL,
server_host text NOT NULL,
server_host varchar(191) NOT NULL,
opts text NOT NULL,
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (server_host(191), name)
@ -78,7 +78,7 @@ CREATE TABLE sr_group (
CREATE TABLE sr_user (
jid varchar(191) NOT NULL,
server_host text NOT NULL,
server_host varchar(191) NOT NULL,
grp varchar(191) NOT NULL,
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (server_host(191), jid, grp)
@ -89,7 +89,7 @@ CREATE INDEX i_sr_user_sh_grp ON sr_user(server_host(191), grp);
CREATE TABLE spool (
username varchar(191) NOT NULL,
server_host text NOT NULL,
server_host varchar(191) NOT NULL,
xml mediumtext NOT NULL,
seq BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE,
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
@ -100,7 +100,7 @@ CREATE INDEX i_spool_created_at USING BTREE ON spool(created_at);
CREATE TABLE archive (
username varchar(191) NOT NULL,
server_host text NOT NULL,
server_host varchar(191) NOT NULL,
timestamp BIGINT UNSIGNED NOT NULL,
peer varchar(191) NOT NULL,
bare_peer varchar(191) NOT NULL,
@ -120,7 +120,7 @@ CREATE INDEX i_archive_sh_timestamp USING BTREE ON archive(server_host(191), tim
CREATE TABLE archive_prefs (
username varchar(191) NOT NULL,
server_host text NOT NULL,
server_host varchar(191) NOT NULL,
def text NOT NULL,
always text NOT NULL,
never text NOT NULL,
@ -130,7 +130,7 @@ CREATE TABLE archive_prefs (
CREATE TABLE vcard (
username varchar(191) NOT NULL,
server_host text NOT NULL,
server_host varchar(191) NOT NULL,
vcard mediumtext NOT NULL,
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (server_host(191), username)
@ -139,7 +139,7 @@ CREATE TABLE vcard (
CREATE TABLE vcard_search (
username varchar(191) NOT NULL,
lusername varchar(191) NOT NULL,
server_host text NOT NULL,
server_host varchar(191) NOT NULL,
fn text NOT NULL,
lfn varchar(191) NOT NULL,
family text NOT NULL,
@ -179,14 +179,14 @@ CREATE INDEX i_vcard_search_sh_lorgunit ON vcard_search(server_host(191), lorgu
CREATE TABLE privacy_default_list (
username varchar(191) NOT NULL,
server_host text NOT NULL,
server_host varchar(191) NOT NULL,
name varchar(191) NOT NULL,
PRIMARY KEY (server_host(191), username)
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE TABLE privacy_list (
username varchar(191) NOT NULL,
server_host text NOT NULL,
server_host varchar(191) NOT NULL,
name varchar(191) NOT NULL,
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE,
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
@ -212,7 +212,7 @@ CREATE INDEX i_privacy_list_data_id ON privacy_list_data(id);
CREATE TABLE private_storage (
username varchar(191) NOT NULL,
server_host text NOT NULL,
server_host varchar(191) NOT NULL,
namespace varchar(191) NOT NULL,
data text NOT NULL,
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
@ -224,7 +224,7 @@ CREATE INDEX i_private_storage_sh_username USING BTREE ON private_storage(server
-- Not tested in mysql
CREATE TABLE roster_version (
username varchar(191) NOT NULL,
server_host text NOT NULL,
server_host varchar(191) NOT NULL,
version text NOT NULL,
PRIMARY KEY (server_host(191), username)
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
@ -292,7 +292,7 @@ CREATE UNIQUE INDEX i_pubsub_subscription_opt ON pubsub_subscription_opt(subid(3
CREATE TABLE muc_room (
name text NOT NULL,
host text NOT NULL,
server_host text NOT NULL,
server_host varchar(191) NOT NULL,
opts mediumtext NOT NULL,
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
@ -302,7 +302,7 @@ CREATE UNIQUE INDEX i_muc_room_name_host USING BTREE ON muc_room(name(75), host(
CREATE TABLE muc_registered (
jid text NOT NULL,
host text NOT NULL,
server_host text NOT NULL,
server_host varchar(191) NOT NULL,
nick text NOT NULL,
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
@ -313,7 +313,7 @@ CREATE UNIQUE INDEX i_muc_registered_jid_host USING BTREE ON muc_registered(jid(
CREATE TABLE muc_online_room (
name text NOT NULL,
host text NOT NULL,
server_host text NOT NULL,
server_host varchar(191) NOT NULL,
node text NOT NULL,
pid text NOT NULL
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
@ -326,7 +326,7 @@ CREATE TABLE muc_online_users (
resource text NOT NULL,
name text NOT NULL,
host text NOT NULL,
server_host text NOT NULL,
server_host varchar(191) NOT NULL,
node text NOT NULL
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
@ -347,7 +347,7 @@ CREATE INDEX i_muc_room_subscribers_host_jid USING BTREE ON muc_room_subscribers
CREATE TABLE motd (
username varchar(191) NOT NULL,
server_host text NOT NULL,
server_host varchar(191) NOT NULL,
xml text,
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (server_host(191), username)
@ -367,7 +367,7 @@ CREATE TABLE sm (
pid text NOT NULL,
node text NOT NULL,
username varchar(191) NOT NULL,
server_host text NOT NULL,
server_host varchar(191) NOT NULL,
resource varchar(191) NOT NULL,
priority text NOT NULL,
info text NOT NULL,
@ -386,7 +386,7 @@ CREATE TABLE oauth_token (
CREATE TABLE route (
domain text NOT NULL,
server_host text NOT NULL,
server_host varchar(191) NOT NULL,
node text NOT NULL,
pid text NOT NULL,
local_hint text NOT NULL
@ -417,7 +417,7 @@ CREATE INDEX i_proxy65_jid ON proxy65 (jid_i(191));
CREATE TABLE push_session (
username text NOT NULL,
server_host text NOT NULL,
server_host varchar(191) NOT NULL,
timestamp bigint NOT NULL,
service text NOT NULL,
node text NOT NULL,
@ -471,7 +471,7 @@ CREATE INDEX i_mix_subscription_chan_serv ON mix_subscription (channel(191), ser
CREATE TABLE mix_pam (
username text NOT NULL,
server_host text NOT NULL,
server_host varchar(191) NOT NULL,
channel text NOT NULL,
service text NOT NULL,
id text NOT NULL,