Why MySQL SELECT performance depends on table size? I've got two identical tables with the following structure:

CREATE TABLE words (
  id bigint(20) NOT NULL,
  `text` int(11) NOT NULL,
  w1 int(11) NOT NULL, 
  w2 int(11) NOT NULL, 
  w3 int(11) NOT NULL, 
  w4 int(11) NOT NULL, 
  w5 int(11) NOT NULL,
  w6 int(11) NOT NULL, 
  w7 int(11) NOT NULL, 
  w8 int(11) NOT NULL, 
  w9 int(11) NOT NULL,
  PRIMARY KEY (id),
  KEY w1 (w1),
  KEY w2 (w2),
  KEY w3 (w3),
  KEY w4 (w4)
) ENGINE=MyISAM DEFAULT CHARSET=ascii;


The first one contains 100M rows and the second one 300M rows. The following query

SELECT id FROM words WHERE w2=3112



takes 0.16 sec for the first (smaller) table
and 20 sec for the second (that is just three times bigger)


Why the difference in timings is so huge? Is there any configuration setting that I can change to improve it?

The execution plains are the following:

1st table:

+----+-------------+-------+------+---------------+------+---------+-------+------+-------+
| id | select_type | table | type | possible_keys | key  | key_len | ref   | rows | Extra |
+----+-------------+-------+------+---------------+------+---------+-------+------+-------+
|  1 | SIMPLE      | wd3   | ref  | w2            | w2   | 4       | const | 2050 |       |
+----+-------------+-------+------+---------------+------+---------+-------+------+-------+


2nd table:

+----+-------------+-------+------+---------------+------+---------+-------+------+-------+
| id | select_type | table | type | possible_keys | key  | key_len | ref   | rows | Extra |
+----+-------------+-------+------+---------------+------+---------+-------+------+-------+
|  1 | SIMPLE      | wd2   | ref  | w2            | w2   | 4       | const | 7440 |       |
+----+-------------+-------+------+---------------+------+---------+-------+------+-------+
Eventually I realized that it was some king of caching and probably on Linux level. 

After applying # sync &amp;&amp; echo 3 | tee /proc/sys/vm/drop_caches followed by mysql&gt; RESET QUERY CACHE; the query time became linear. 

Note though, that before this the effect was stable on different queries.