[wp-trac] [WordPress Trac] #15004: Missing index on signups table

WordPress Trac wp-trac at lists.automattic.com
Tue Jul 10 14:03:15 UTC 2012


#15004: Missing index on signups table
------------------------------+------------------
 Reporter:  barry             |       Owner:
     Type:  defect (bug)      |      Status:  new
 Priority:  normal            |   Milestone:  3.5
Component:  Database          |     Version:
 Severity:  normal            |  Resolution:
 Keywords:  has-patch commit  |
------------------------------+------------------
Description changed by nacin:

Old description:

> wp-includes/ms-functions.php:590:       $signup = $wpdb->get_row(
> $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE user_email = %s",
> $user_email) );
> wp-includes/ms-functions.php:595:                       $wpdb->query(
> $wpdb->prepare("DELETE FROM $wpdb->signups WHERE user_email = %s",
> $user_email) );
>
> But there is no index on user_email in the signups table.  Makes these
> queries perform a full table scan which is slow when you have lots of
> signups.
>
> Attached patch adds the index but I can't figure out how schema upgrades
> on MS-specific tables ever get run after the initial activation of MS
> mode and table creation.

New description:

 {{{
 wp-includes/ms-functions.php:590:
 $signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups
 WHERE user_email = %s", $user_email) );
 wp-includes/ms-functions.php:595:
 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->signups WHERE user_email
 = %s", $user_email) );
 }}}

 But there is no index on user_email in the signups table.  Makes these
 queries perform a full table scan which is slow when you have lots of
 signups.

 Attached patch adds the index but I can't figure out how schema upgrades
 on MS-specific tables ever get run after the initial activation of MS mode
 and table creation.

--

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


More information about the wp-trac mailing list