| 开发者 |
OllieJones
Ollie Jones Oliver Jones |
|---|---|
| 更新时间 | 2025年11月18日 00:41 |
| 捐献地址: | 去捐款 |
| PHP版本: | 5.6 及以上 |
| WordPress版本: | 6.9 |
| 版权: | GPL v2 or later |
| 版权网址: | 版权信息 |
wp plugin install index-wp-users-for-speed wp plugin activate index-wp-users-for-speed
Composer
If you configure your WordPress installation using composer, you may install this plugin into your WordPress top level configuration with this command.
composer require "wpackagist-plugin/index-wp-users-for-speed":"^1.1"
Credits
Yes. Backups are good practice. Still, this plugin makes no changes to your site or database layout. It adds a few non-autoloaded options, and adds rows to wp_usermeta. = My WordPress host offers MariaDB, not MySQL. Can I use this plugin? Yes. = I have a multi-site WordPress installation. Can I use this plugin? Yes. = I see high CPU usage (load average) on my MariaDB / MySQL database server during user index building or refresh. Is that normal? Yes. Indexing your registered users requires us to insert a row in your wp_usermeta tab;e for each of them. We do this work in batches of 5000 users to avoid locking up your MariaDB / MySQL server. Each batch takes server time. Once all index building or refresh batches are complete, your CPU usage will return to normal. = Can I use this if I have disabled WP_Cron and use an operating system cronjob instead? Yes
Plugins like Vladimir Garagulya's User Role Editor let you assign multiple roles to users. This plugin handles those users correctly.
Standard WordPress puts a wp_capabilities row in the wp_usermeta table for each user. Its meta_value contains a small data structure. For example, an author has this data structure.
array("author")
In order to find all the authors WordPress must issue a database query containing a filter like this one, that starts and ends with the SQL wildcard character %.
meta_key = 'wp_capabilities' AND meta_value LIKE '%"author"%'
Filters like that are notoriously slow: they cannot exploit any database keys, and so MySQL or MariaDB must examine that wp_usermeta row for every user in your site.
This plugin adds rows to wp_usermeta describing each user's role (or roles) in a way that's easier to search. To find authors, the plugin uses this much faster filter instead.
meta_key = 'wp_index_wp_users_for_speed_role_author'
It takes a while to insert these extra indexing rows into the database; that happens with WP_Cron tasks in the background.
Once the indexing rows are in place, you can add, delete, or change user roles without regenerating those rows: the plugin maintains them.
It performs the indexing for batches of users, each in a separate WP_Cron task. The number of users in a batch defaults to 5000 and can be set, if need be, with the INDEX_WP_USERS_FOR_SPEED_BATCHSIZE variable in wp-config.php. It breaks each batch into chunks of 50 users, by default. That can be set with the INDEX_WP_USERS_FOR_SPEED_CHUNKSIZE variable in wp-config.php.
WordPress's trac (defect-tracking) system has this ticket # 38741.
Three reasons (maybe four):