core icon indicating copy to clipboard operation
core copied to clipboard

Database (MySQL): (partly) Duplicate Indexes

Open fgusinde opened this issue 12 years ago • 1 comments

I had a look from a DBA to the Database (MySQL/MariaDB) and found some partly duplicate indexes:

-- ######################################################################## -- owncloud.oc_appconfig
-- ########################################################################

-- appconfig_appid_key is a left-prefix of PRIMARY -- Key definitions: -- KEY appconfig_appid_key (appid) -- PRIMARY KEY (appid,configkey), -- Column types: -- appid varchar(32) collate utf8_bin not null default '' -- configkey varchar(64) collate utf8_bin not null default '' -- To remove this duplicate index, execute: ALTER TABLE owncloud.oc_appconfig DROP INDEX appconfig_appid_key;

-- ######################################################################## -- owncloud.oc_documents_op
-- ########################################################################

-- Key documents_op_eis_idx ends with a prefix of the clustered index -- Key definitions: -- UNIQUE KEY documents_op_eis_idx (es_id,seq) -- PRIMARY KEY (seq), -- Column types: -- es_id varchar(64) collate utf8_bin not null comment 'editing session id' -- seq int(10) unsigned not null auto_increment comment 'sequence number' -- To shorten this duplicate clustered index, execute: ALTER TABLE owncloud.oc_documents_op DROP INDEX documents_op_eis_idx, ADD INDEX documents_op_eis_idx (es_id);

-- ######################################################################## -- owncloud.oc_filecache
-- ########################################################################

-- Key fs_storage_size ends with a prefix of the clustered index -- Key definitions: -- KEY fs_storage_size (storage,size,fileid) -- PRIMARY KEY (fileid), -- Column types: -- storage int(11) not null default '0' -- size bigint(20) not null default '0' -- fileid int(11) not null auto_increment -- To shorten this duplicate clustered index, execute: ALTER TABLE owncloud.oc_filecache DROP INDEX fs_storage_size, ADD INDEX fs_storage_size (storage,size);

-- ######################################################################## -- owncloud.oc_share_external
-- ########################################################################

-- sh_external_user is a left-prefix of sh_external_mp -- Key definitions: -- KEY sh_external_user (user) -- UNIQUE KEY sh_external_mp (user,mountpoint_hash), -- Column types: -- user varchar(64) collate utf8_bin not null comment 'local user which added the external share' -- mountpoint_hash varchar(32) collate utf8_bin not null comment 'md5 hash of the mountpoint' -- To remove this duplicate index, execute: ALTER TABLE owncloud.oc_share_external DROP INDEX sh_external_user;

fgusinde avatar Jul 29 '14 11:07 fgusinde

Oh, seems the duplicate index is still there

PVince81 avatar Oct 07 '16 13:10 PVince81