title: How to prevent a full table scan when doing a simple JOIN?
body: <p><b>I have two tables, TableA and TableB:</b></p>
  
  <pre><code>CREATE TABLE `TableA` (
    `shared_id` int(10) unsigned NOT NULL default '0',
    `foo` int(10) unsigned NOT NULL,
    PRIMARY KEY  (`shared_id`)
  ) ENGINE=MyISAM DEFAULT CHARSET=latin1
  
  
  CREATE TABLE `TableB` (
    `shared_id` int(10) unsigned NOT NULL auto_increment,
    `bar` int(10) unsigned NOT NULL,
    KEY `shared_id` (`shared_id`)
  ) ENGINE=MyISAM AUTO_INCREMENT=1001 DEFAULT CHARSET=latin1 
  </code></pre>
  
  <p><b>Here's my query:</b></p>
  
  <pre><code>SELECT TableB.bar 
  FROM TableB, TableA 
  WHERE TableA.foo = 1000 
  AND TableA.shared_id = TableB.shared_id;
  </code></pre>
  
  <p><b>Here's the problem:</b></p>
  
  <pre><code>mysql&gt; explain SELECT TableB.bar FROM TableB, TableA WHERE TableA.foo = 1000 AND TableA.shared_id = TableB.shared_id;
  
  +----+-------------+--------------+--------+---------------+---------+---------+------------------------------------------+------+-------------+
  | id | select_type | table        | type   | possible_keys | key     | key_len | ref                                      | rows | Extra       |
  +----+-------------+--------------+--------+---------------+---------+---------+------------------------------------------+------+-------------+
  |  1 | SIMPLE      | TableB       | ALL    | shared_id     | NULL    | NULL    | NULL                                     | 1000 |             |
  |  1 | SIMPLE      | TableA       | eq_ref | PRIMARY       | PRIMARY | 4       | MyDatabase.TableB.shared_id              |    1 | Using where |
  +----+-------------+--------------+--------+---------------+---------+---------+------------------------------------------+------+-------------+
  </code></pre>
  
  <p><b>Is there an index that I can add that will prevent the full table scan of TableB?</b></p>