Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extremely slow queries to wp_X_mf_post_meta #153

Closed
jb510 opened this issue Oct 11, 2012 · 2 comments
Closed

Extremely slow queries to wp_X_mf_post_meta #153

jb510 opened this issue Oct 11, 2012 · 2 comments

Comments

@jb510
Copy link
Contributor

jb510 commented Oct 11, 2012

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.

Questions:

  1. Would it not make sense to index those fields by default? (Again, beyond my expertise)
  2. What happened to the query caching? (it seems irrelevant to my performance issues, but still it look 'right' before and now it's gone).

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.

jb510 added a commit to jb510/Magic-Fields-2 that referenced this issue Oct 14, 2012
Signed-off-by: Jon Brown <jon@jbrownstudios.com>
@jb510
Copy link
Contributor Author

jb510 commented Oct 14, 2012

Trying to make a pull request for: jb510@82e0c12

@gnuget
Copy link
Member

gnuget commented Dec 5, 2012

can you use EXPLAIN in a query with and without the index?

With that we can make sure about the performance improvement

Thank you

hunk added a commit that referenced this issue Dec 9, 2012
Fix for Issue #153 (not retroactive, just for new tables)
@hunk hunk closed this as completed Dec 9, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants