WordPress.org

Ready to get started?Download WordPress

Forums

WP-Polls
Performance issue: add index to the db table (1 post)

  1. sforman71
    Member
    Posted 2 years ago #

    This may have been fixed since I last updated, but in case not it appears that adding the following index can make it quite a bit faster.

    mysql> explain SELECT pollip_aid FROM wp_pollsip WHERE pollip_qid = 278 AND
    pollip_ip = '65.52.109.153'\G
    *************************** 1. row ***************************
              id: 1
     select_type: SIMPLE
           table: wp_pollsip
            type: ALL
    possible_keys: pollip_qid
             key: NULL
         key_len: NULL
             ref: NULL
            rows: 35906
           Extra: Using where
    1 row in set (0.00 sec)
    
    mysql> alter table wp_pollsip add index ip_qid (pollip_ip, pollip_qid);
    Query OK, 35906 rows affected (0.79 sec)
    Records: 35906  Duplicates: 0  Warnings: 0
    
    mysql> explain SELECT pollip_aid FROM wp_pollsip WHERE pollip_qid = 278 AND
    pollip_ip = '65.52.109.153'\G
    *************************** 1. row ***************************
              id: 1
     select_type: SIMPLE
           table: wp_pollsip
            type: ref
    possible_keys: pollip_qid,ip_qid
             key: ip_qid
         key_len: 102
             ref: const
            rows: 1
           Extra: Using where
    1 row in set (0.00 sec)
    
    One row instead of thousands.

    http://wordpress.org/extend/plugins/wp-polls/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags