Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ah, I think I know what your issue is. According to the <a href="http://dev.mysql.com/doc/refman/5.1/en/index-hints.html" rel="nofollow">MySQL documentation</a>:</p> <blockquote> <p>By specifying USE INDEX (index_list), you can tell MySQL to use only one of the named indexes to find rows in the table. The alternative syntax IGNORE INDEX (index_list) can be used to tell MySQL to not use some particular index or indexes. These hints are useful if EXPLAIN shows that MySQL is using the wrong index from the list of possible indexes.</p> <p>You can also use FORCE INDEX, which acts like USE INDEX (index_list) but with the addition that a table scan is assumed to be very expensive. In other words, a table scan is used only if there is no way to use one of the given indexes to find rows in the table.</p> </blockquote> <p>In other words, by using FORCE INDEX, you're telling MySQL to <em>only</em> use the <code>customer_history_n2</code> index and skip over all of the other available indexes. You need to remove the FORCE INDEX clause from your query, or else specify it as this instead so that it will use the indexes for the other columns that are available:</p> <pre><code>SELECT customer_history.customer_id, customer_history.row_mod, customer_history.row_create, customer_history.event_id, customer_history.event_type, customer_history.new_value, customer_history.old_value FROM customer_history FORCE INDEX (customer_history_n2, customer_history_n1, customer_id1) WHERE customer_id &gt;= 1 AND customer_id &lt; 5000000 AND (customer_history.row_mod &gt;= '2012-10-01') OR ( customer_history.row_create &gt;= '2012-10-01' AND customer_history.row_create &lt; '2012-10-13' ); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload