Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Extremely slow queries to wp_X_mf_post_meta #153
I got asked to look at a slow site and while there were a couple issues the biggest was that each get() on the template part was taking 40ms to return (every other query was taking 0.5ms as I'd expect).
This template should have been using get_group(), but was instead using 15 separate get('field_name') functions to query 15 separate fields, looped 30 times... so about 500 of these 40ms queries per page load.
I'm far from a MySQL expert, but indexing meta_id against post_id fixed the performance issues instantly.
I also noticed the query caching seems to of been removed between 2.0 and 2.0.1 for the get_data() function.
This site is multi-site, 13 sub-sites. CPTs have 5-10 fields added, 100s of posts. It's really not "that" big. the biggest table it 10MB, most are smaller.