title: MySQL join query not using Indexes?
body: <p>I have this query:</p>
  
  <pre><code>SELECT 
      COUNT(*) AS `numrows` 
  FROM (`tbl_A`) 
  JOIN `tbl_B` ON `tbl_A`.`B_id` = `tbl_B`.`id` 
  WHERE 
      `tbl_B`.`boolean_value` &lt;&gt; 1;
  </code></pre>
  
  <p>I added three indexes for <code>tbl_A</code>.<code>B_id</code>, <code>tbl_B</code>.<code>id</code> and <code>tbl_B</code>.<code>boolean_value</code> but mysql still says it doesn't use indexes (in queries not using indexes log) and it examine whole of tables to retrieve the result.</p>
  
  <p>I need to know what I should do to optimize this query.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Explain output:</p>
  
  <pre><code>id  select_type table  type  possible_keys          key   key_len  ref      rows  Extra 
  1    SIMPLE     tbl_B  ALL   PRIMARY,boolean_value  NULL  NULL     NULL     5049  Using where
  1    SIMPLE     tbl_A  ref   B_id                   B_id  9        tbl_B.id 9     Using where; Using index
  </code></pre>