[wp-trac] [WordPress Trac] #55911: Slow query because Admin Bar loads all options on all user's sites

WordPress Trac noreply at wordpress.org
Fri Jun 3 21:18:58 UTC 2022


#55911: Slow query because Admin Bar loads all options on all user's sites
-------------------------+-------------------------------------
 Reporter:  iandunn      |       Owner:  (none)
     Type:  enhancement  |      Status:  reopened
 Priority:  normal       |   Milestone:
Component:  Toolbar      |     Version:  3.1
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:  multisite, performance
-------------------------+-------------------------------------
Changes (by iandunn):

 * status:  closed => reopened
 * resolution:  duplicate =>


Comment:

 Er, I spoke too soon. Optimizing the meta query in `get_blogs_of_user()`
 would help this indirectly, but I don't think it'd prevent the
 `switch_to_blog() > ... > wp_load_alloptions()` loop . That's triggered by
 `get_blogs_of_user() > $site->id > WP_Site::get_details()`.

 There's also the 2nd `switch_to_blog()` loop triggered by
 `wp_admin_bar_my_sites_menu()`, which would just re-introduce the problem
 even if `get_blogs_of_user()` had fast meta queries and didn't indirectly
 call `switch_to_blog()`.

 So I think there are 3 things that need to happen:

 1. Optimize the meta query in `get_blogs_of_user()` - #31746
 1. Optimize the `$site->foo` calls in `get_blogs_of_user()` - #31746 or
 this ticket?
 1. Optimize the `switch_to_blog()` calls in `wp_admin_bar_my_sites_menu()`
 - this ticket

 cc @nerrad

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/55911#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list