Schema: Add an index to `wp_options.autoload`.

Most sites will be unaffected by this change, but those with a large number of rows in `wp_options`, only a small number of which have `autoload` set, will see a significant performance improvement.

Sites with a large number of rows in `wp_options`, with many of them having `autoload` set will unfortunately see a performance penalty on top of the already very slow queries they're running, but this should be the minority of cases.

Props DanBUK.
Fixes #24044.

Built from https://develop.svn.wordpress.org/trunk@45805


git-svn-id: http://core.svn.wordpress.org/trunk@45616 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2019-08-15 07:13:55 +00:00
parent 98ffc642a9
commit 7169586254
2 changed files with 4 additions and 3 deletions

View File

@ -144,7 +144,8 @@ CREATE TABLE $wpdb->options (
option_value longtext NOT NULL,
autoload varchar(20) NOT NULL default 'yes',
PRIMARY KEY (option_id),
UNIQUE KEY option_name (option_name)
UNIQUE KEY option_name (option_name),
KEY autoload (autoload)
) $charset_collate;
CREATE TABLE $wpdb->postmeta (
meta_id bigint(20) unsigned NOT NULL auto_increment,

View File

@ -13,14 +13,14 @@
*
* @global string $wp_version
*/
$wp_version = '5.3-alpha-45804';
$wp_version = '5.3-alpha-45805';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
*
* @global int $wp_db_version
*/
$wp_db_version = 45744;
$wp_db_version = 45805;
/**
* Holds the TinyMCE version