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.


git-svn-id: https://develop.svn.wordpress.org/trunk@45805 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast 2019-08-15 07:12:04 +00:00
parent e982455e44
commit 9c3fb72719
2 changed files with 3 additions and 2 deletions

View File

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

View File

@ -20,7 +20,7 @@ $wp_version = '5.3-alpha-45282-src';
* *
* @global int $wp_db_version * @global int $wp_db_version
*/ */
$wp_db_version = 45744; $wp_db_version = 45805;
/** /**
* Holds the TinyMCE version * Holds the TinyMCE version