Support » Developing with WordPress » wp_dropdown_users slow

  • Hi everyone,

    We run a WordPress installation with a large number of registered users (400,000+).

    I don’t think WordPress was really designed for this number of users, but we’re a bit stuck.

    Our WordPress edit.php is slow due to this query which is called twice

    SELECT wp_users.ID,wp_users.user_login,wp_users.display_name
    FROM wp_users
    INNER JOIN wp_usermeta
    ON ( wp_users.ID = wp_usermeta.user_id )
    WHERE 1=1
    AND ( ( wp_usermeta.meta_key = ‘wp_user_level’
    AND wp_usermeta.meta_value != ‘0’ ) )
    ORDER BY display_name ASC

    I think this is for the quick edit function for posts and pages – it shows a dropdown of only 2 authors. Is there a way to disable the quick edit author and stop this slow query every time we load edit.php?

    Thanks all

Viewing 2 replies - 1 through 2 (of 2 total)
  • What’s this for ?
    > WHERE 1=1
    You’re only selecting 1 user ?

    I’m not exactly sure what you are trying to accomplish, but here is a thread to disable Quick Edit for all users, or a specific user :
    https://wordpress.stackexchange.com/questions/91511/disable-quick-edit-only-for-non-admin-in-functions-php

    400k+ registered users sounds like a lot! Are you using a Membership plugin ?
    I have one client who has over 20k users (which I felt was a lot, lol), and we are in the process of moving them off of WordPress and over to Wicket :
    https://wicket.io/
    Wicket rocks, and they take care of all of the data massaging and migration in the onboarding process.

    Moderator bcworkz

    (@bcworkz)

    The 1=1 clause gets inserted when WP_User_Query begins constructing a SQL query. It needs some value for the WHERE clause while it doesn’t yet know if there will be any actual restrictions. 1=1 makes the WHERE clause a valid syntax should there not be any added restrictions, and yet further restrictions can be joined with AND without concern of it being the first restriction or not.

    The slow down is a combination of many users and the use of meta data to qualify the query. WP doesn’t have a problem with lots of users, but your database might. It may help if the meta key and value columns are indexed, but making frequent queries by meta data simply isn’t very efficient. Important query criteria would be better saved in a custom table which is designed for optimal efficiency for the anticipated queries.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp_dropdown_users slow’ is closed to new replies.