Make WordPress Core

Opened 2 months ago

Last modified 2 months ago

#54479 new enhancement

Set_blog_id performance

Reported by: wladwm Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: trunk
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.

2 months ago

  • Keywords has-patch added


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

Trac ticket: https://core.trac.wordpress.org/ticket/54479

#2 @johnbillion
2 months 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 2 months ago by johnbillion (previous) (diff)

#3 @wladwm
2 months 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.