https://bugzilla.wikimedia.org/show_bug.cgi?id=31454

--- Comment #8 from Tim Starling <[email protected]> 2011-10-24 02:20:59 
UTC ---
The query is missing quotation marks around the timestamps, which causes the
index to not be used correctly.

mysql> explain select count(*) from cu_changes where cuc_timestamp BETWEEN
20110726014800 AND 20110726014919\G
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: cu_changes
         type: index
possible_keys: cuc_timestamp
          key: cuc_timestamp
      key_len: 16
          ref: NULL
         rows: 16846048
        Extra: Using where; Using index
1 row in set (0.00 sec)

mysql> explain select count(*) from cu_changes where cuc_timestamp BETWEEN
'20110726014800' AND '20110726014919'\G
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: cu_changes
         type: range
possible_keys: cuc_timestamp
          key: cuc_timestamp
      key_len: 16
          ref: NULL
         rows: 167
        Extra: Using where; Using index
1 row in set (0.00 sec)

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to