wiki.techinc.nl/maintenance/sqlite/archives/patch-sites-drop_indexes.sql
Amir Sarabadani 616744db1d Schema: Drop unused and useless indexes of sites table
This table has eight indexes plus PK. It has around 1000 rows only. Even
if it needs these indexes (which it doesn't), they are still useless.

Looking at the code, the only potential useful index is the one on
site_global_key, they are showing up in the report of unused indexes in
the db and I checked with Fandom (which might benefit from an index on
this table) and they said they don't use sites table.

Bug: T342856
Change-Id: I06b3db0f33bd35bfa68f4b418d8c2f4b9b988409
2024-02-01 15:32:05 +01:00

57 lines
1.4 KiB
SQL

-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
-- Source: maintenance/abstractSchemaChanges/patch-sites-drop_indexes.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TEMPORARY TABLE /*_*/__temp__sites AS
SELECT
site_id,
site_global_key,
site_type,
site_group,
site_source,
site_language,
site_protocol,
site_domain,
site_data,
site_forward,
site_config
FROM /*_*/sites;
DROP TABLE /*_*/sites;
CREATE TABLE /*_*/sites (
site_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
site_global_key BLOB NOT NULL,
site_type BLOB NOT NULL,
site_group BLOB NOT NULL,
site_source BLOB NOT NULL,
site_language BLOB NOT NULL,
site_protocol BLOB NOT NULL,
site_domain VARCHAR(255) NOT NULL,
site_data BLOB NOT NULL,
site_forward SMALLINT NOT NULL,
site_config BLOB NOT NULL
);
INSERT INTO /*_*/sites (
site_id, site_global_key, site_type,
site_group, site_source, site_language,
site_protocol, site_domain, site_data,
site_forward, site_config
)
SELECT
site_id,
site_global_key,
site_type,
site_group,
site_source,
site_language,
site_protocol,
site_domain,
site_data,
site_forward,
site_config
FROM
/*_*/__temp__sites;
DROP TABLE /*_*/__temp__sites;
CREATE UNIQUE INDEX site_global_key ON /*_*/sites (site_global_key);