top of page
CerebroSQL

MySQL: 

CACHE INDEX

Syntax:
CACHE INDEX {
tbl_index_list [, tbl_index_list] ...
| tbl_name PARTITION (partition_list)
}
IN key_cache_name

tbl_index_list:
tbl_name [{INDEX|KEY} (index_name[, index_name] ...)]

partition_list: {
partition_name[, partition_name] ...
| ALL
}

The CACHE INDEX statement assigns table indexes to a specific key
cache. It applies only to MyISAM tables, including partitioned MyISAM
tables. After the indexes have been assigned, they can be preloaded
into the cache if desired with LOAD INDEX INTO CACHE.

The following statement assigns indexes from the tables t1, t2, and t3
to the key cache named hot_cache:

mysql> CACHE INDEX t1, t2, t3 IN hot_cache;
+---------+--------------------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+---------+--------------------+----------+----------+
| test.t1 | assign_to_keycache | status | OK |
| test.t2 | assign_to_keycache | status | OK |
| test.t3 | assign_to_keycache | status | OK |
+---------+--------------------+----------+----------+

Example

bottom of page