[wp-trac] [WordPress Trac] #23609: get_users() causes a huge number of SQL queries causing 500 server errors
WordPress Trac
noreply at wordpress.org
Mon Feb 25 20:56:13 UTC 2013
#23609: get_users() causes a huge number of SQL queries causing 500 server errors
-----------------------------+--------------------------
Reporter: dpacmittal | Type: defect (bug)
Status: new | Priority: normal
Milestone: Awaiting Review | Component: General
Version: | Severity: normal
Keywords: |
-----------------------------+--------------------------
Hey,
get_users() function causes a 500 server error if no arguments are passed,
that is all user information is trying to be read. On my website with over
50k users, it causes ~15k SQL queries (checked using general query log).
Atleast one plugin I know of uses get_users() without arguments (Events-
manager). This causes the plugin to cause 500 server errors.
Ideally, if no arguments are passed, only a select * from {prefix}_users
should be issued instead of 15k separate queries.
Here's a part from query log which shows individual SQL queries are being
made:
{{{
59 Query SELECT wp_users.* FROM wp_users WHERE 1=1
ORDER BY user_login ASC
130226 2:13:11 59 Query SELECT user_id, meta_key, meta_value FROM
wp_usermeta WHERE user_id IN (26901)
59 Query SELECT user_id, meta_key, meta_value FROM
wp_usermeta WHERE user_id IN (43704)
59 Query SELECT user_id, meta_key, meta_value FROM
wp_usermeta WHERE user_id IN (43674)
59 Query SELECT user_id, meta_key, meta_value FROM
wp_usermeta WHERE user_id IN (41395)
59 Query SELECT user_id, meta_key, meta_value FROM
wp_usermeta WHERE user_id IN (41684)
59 Query SELECT user_id, meta_key, meta_value FROM
wp_usermeta WHERE user_id IN (38434)
59 Query SELECT user_id, meta_key, meta_value FROM
wp_usermeta WHERE user_id IN (36368)
59 Query SELECT user_id, meta_key, meta_value FROM
wp_usermeta WHERE user_id IN (24303)
59 Query SELECT user_id, meta_key, meta_value FROM
wp_usermeta WHERE user_id IN (44830)
59 Query SELECT user_id, meta_key, meta_value FROM
wp_usermeta WHERE user_id IN (23256)
59 Query SELECT user_id, meta_key, meta_value FROM
wp_usermeta WHERE user_id IN (44818)
59 Query SELECT user_id, meta_key, meta_value FROM
wp_usermeta WHERE user_id IN (18293)
59 Query SELECT user_id, meta_key, meta_value FROM
wp_usermeta WHERE user_id IN (20351)
59 Query SELECT user_id, meta_key, meta_value FROM
wp_usermeta WHERE user_id IN (28186)
59 Query SELECT user_id, meta_key, meta_value FROM
wp_usermeta WHERE user_id IN (26348)
59 Query SELECT user_id, meta_key, meta_value FROM
wp_usermeta WHERE user_id IN (32837)
59 Query SELECT user_id, meta_key, meta_value FROM
wp_usermeta WHERE user_id IN (21992)
59 Query SELECT user_id, meta_key, meta_value FROM
wp_usermeta WHERE user_id IN (45162)
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/23609>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list