[wp-trac] [WordPress Trac] #14572: post_author_meta_box causes fatal error on site with large userbase.

WordPress Trac wp-trac at lists.automattic.com
Mon Sep 6 11:01:15 UTC 2010


#14572: post_author_meta_box causes fatal error on site with large userbase.
----------------------------+-----------------------------------------------
 Reporter:  tomdebruin      |       Owner:  scribu          
     Type:  defect (bug)    |      Status:  assigned        
 Priority:  normal          |   Milestone:  3.1             
Component:  Administration  |     Version:  3.0.1           
 Severity:  normal          |    Keywords:  needs-patch gsoc
----------------------------+-----------------------------------------------

Comment(by scribu):

 > I don't know if we should have support for such dangerously suicidal
 queries.

 Let's not exagerate. The API only allows a single meta query, besides the
 role checking.

 > Couldn't you also get around the optimizer's correlated subquery by
 joining the results of the subquery instead?

 You could, but again, it wouldn't make use of the meta_key index.

 Nacin is right. Multiple JOINs are best:

 {{{
 EXPLAIN
 SELECT wp_users.ID FROM wp_users
 INNER JOIN wp_usermeta ON (wp_users.ID = wp_usermeta.user_id)
 INNER JOIN wp_usermeta AS mt1 ON (wp_users.ID = mt1.user_id)
 WHERE 1=1
 AND wp_usermeta.meta_key = 'wp_capabilities'
 AND mt1.meta_key = 'admin_color' AND mt1.meta_value = 'fresh'
 ORDER BY user_login ASC
 }}}

 || id || select_type || table || type || possible_keys || key || key_len
 || ref || rows || Extra ||
 || 1 || SIMPLE || wp_usermeta || ref || user_id,meta_key || meta_key ||
 768 || const || 7 || Using where; Using temporary; Using filesort ||
 || 1 || SIMPLE || wp_users || eq_ref || PRIMARY || PRIMARY || 8 || wp-
 trunk.wp_usermeta.user_id || 1 ||   ||
 || 1 || SIMPLE || mt1 || ref || user_id,meta_key || meta_key || 768 ||
 const || 9 || Using where ||

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14572#comment:31>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list