Make WordPress Core

Opened 3 years ago

Last modified 3 years ago

#54479 new enhancement

Set_blog_id performance

Reported by: wladwm's profile wladwm Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.9
Component: General Keywords: has-patch reporter-feedback
Focuses: multisite, performance Cc:


On multisite many plugins switches blog (wbdb->set_blog_id) many times (few thousands).
There is a performance impact in wpdb->tables method.
Simple caching reduces overall execution time.

Change History (3)

This ticket was mentioned in PR #1925 on WordPress/wordpress-develop by wladwm.

3 years ago

  • Keywords has-patch added

Add tables names caching for multisite in wpdb->set_blog_id to improved performance with blogs switching.

Trac ticket:

#2 @johnbillion
3 years ago

  • Keywords reporter-feedback added

Thanks for the PR @wladwm! And welcome.

Could you share some before and after performance numbers please? Would be good to see what impact this has.


Last edited 3 years ago by johnbillion (previous) (diff)

#3 @wladwm
3 years ago

Hi johnbillion.

On some pages delay for example was reduced from 5.92sec to 5.17sec.
But with some plugin I even cant open some pages w/o patch - cloudfare timeout occurs.
I did some debugging yesterday when discovered this issue with massive blog switching:

Note: See TracTickets for help on using tickets.