-- which allows for fast searching for all pages under example.com with the
-- clause:
-- WHERE el_index LIKE 'http://com.example.%'
- el_index nvarchar(450) NOT NULL
+ el_index nvarchar(450) NOT NULL,
+
+ -- This is el_index truncated to 60 bytes to allow for sortable queries that
+ -- aren't supported by a partial index.
+ -- @todo Drop the default once this is deployed everywhere and code is populating it.
+ el_index_60 varbinary(60) NOT NULL default ''
);
CREATE INDEX /*i*/el_from ON /*_*/externallinks (el_from);
CREATE INDEX /*i*/el_index ON /*_*/externallinks (el_index);
+CREATE INDEX /*i*/el_index_60 ON /*_*/externallinks (el_index_60, el_id);
+CREATE INDEX /*i*/el_from_index_60 ON /*_*/externallinks (el_from, el_index_60, el_id);
-- el_to index intentionally not added; we cannot index nvarchar(max) columns,
-- but we also cannot restrict el_to to a smaller column size as the external
-- link may be larger.
img_media_type varchar(16) default null,
-- major part of a MIME media type as defined by IANA
- -- see http://www.iana.org/assignments/media-types/
+ -- see https://www.iana.org/assignments/media-types/
img_major_mime varchar(16) not null default 'unknown',
-- minor part of a MIME media type as defined by IANA
-- the minor parts are not required to adher to any standard
-- but should be consistent throughout the database
- -- see http://www.iana.org/assignments/media-types/
+ -- see https://www.iana.org/assignments/media-types/
img_minor_mime nvarchar(100) NOT NULL default 'unknown',
-- Description field as entered by the uploader.
CREATE INDEX /*i*/rc_ip ON /*_*/recentchanges (rc_ip);
CREATE INDEX /*i*/rc_ns_usertext ON /*_*/recentchanges (rc_namespace, rc_user_text);
CREATE INDEX /*i*/rc_user_text ON /*_*/recentchanges (rc_user_text, rc_timestamp);
+CREATE INDEX /*i*/rc_name_type_patrolled_timestamp ON /*_*/recentchanges (rc_namespace, rc_type, rc_patrolled, rc_timestamp);
CREATE TABLE /*_*/watchlist (
-- A table to track tags for revisions, logs and recent changes.
CREATE TABLE /*_*/change_tag (
+ ct_id int NOT NULL PRIMARY KEY IDENTITY,
-- RCID for the change
ct_rc_id int NULL REFERENCES /*_*/recentchanges(rc_id),
-- LOGID for the change
-- Rollup table to pull a LIST of tags simply without ugly GROUP_CONCAT
-- that only works on MySQL 4.1+
CREATE TABLE /*_*/tag_summary (
+ ts_id int NOT NULL PRIMARY KEY IDENTITY,
-- RCID for the change
ts_rc_id int NULL REFERENCES /*_*/recentchanges(rc_id),
-- LOGID for the change