LOAD INDEX INTO CACHEtbl_index_list
[,tbl_index_list
] ...tbl_index_list
:tbl_name
[PARTITION (partition_list
)] [{INDEX|KEY} (index_name
[,index_name
] ...)] [IGNORE LEAVES]partition_list
: {partition_name
[,partition_name
] ... | ALL }
The LOAD INDEX INTO CACHE
statement preloads a table index into the key cache to which it has been assigned by an explicit CACHE INDEX
statement, or into the default key cache otherwise.
LOAD INDEX INTO CACHE
applies only to MyISAM
tables, including partitioned MyISAM
tables. In addition, indexes on partitioned tables can be preloaded for one, several, or all partitions.此外,可以为一个、多个或所有分区预加载分区表上的索引。
The IGNORE LEAVES
modifier causes only blocks for the nonleaf nodes of the index to be preloaded.IGNORE LEAVES
修饰符只会预加载索引的非叶节点的块。
对于分区的IGNORE LEAVES
is also supported for partitioned MyISAM
tables.MyISAM
表,也支持IGNORE LEAVES
。
The following statement preloads nodes (index blocks) of indexes for the tables 以下语句预加载表t1
and t2
:t1
和t2
的索引节点(索引块):
mysql> LOAD INDEX INTO CACHE t1, t2 IGNORE LEAVES;
+---------+--------------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+---------+--------------+----------+----------+
| test.t1 | preload_keys | status | OK |
| test.t2 | preload_keys | status | OK |
+---------+--------------+----------+----------+
This statement preloads all index blocks from 此语句预加载t1
. t1
中的所有索引块。It preloads only blocks for the nonleaf nodes from 它只预加载t2
.t2
中非叶节点的块。
The syntax of LOAD INDEX INTO CACHE
enables you to specify that only particular indexes from a table should be preloaded. LOAD INDEX INTO CACHE
的语法允许您指定只应预加载表中的特定索引。However, the implementation preloads all the table's indexes into the cache, so there is no reason to specify anything other than the table name.但是,该实现将所有表的索引预加载到缓存中,因此没有理由指定表名以外的任何内容。
It is possible to preload indexes on specific partitions of partitioned 可以在分区MyISAM
tables. MyISAM
表的特定分区上预加载索引。For example, of the following 2 statements, the first preloads indexes for partition p0
of a partitioned table pt
, while the second preloads the indexes for partitions p1
and p3
of the same table:
LOAD INDEX INTO CACHE pt PARTITION (p0); LOAD INDEX INTO CACHE pt PARTITION (p1, p3);
To preload the indexes for all partitions in table 要预加载表pt
, you can use either of the following two statements:pt
中所有分区的索引,可以使用以下两条语句之一:
LOAD INDEX INTO CACHE pt PARTITION (ALL); LOAD INDEX INTO CACHE pt;
The two statements just shown are equivalent, and issuing either one has exactly the same effect. 刚才显示的两个语句是等效的,发布其中任何一个语句都具有完全相同的效果。In other words, if you wish to preload indexes for all partitions of a partitioned table, the 换句话说,如果希望为分区表的所有分区预加载索引,PARTITION (ALL)
clause is optional.PARTITION (ALL)
子句是可选的。
When preloading indexes for multiple partitions, the partitions need not be contiguous, and you need not list their names in any particular order.在为多个分区预加载索引时,分区不需要是连续的,也不需要按任何特定顺序列出它们的名称。
LOAD INDEX INTO CACHE ... IGNORE LEAVES
fails unless all indexes in a table have the same block size. LOAD INDEX INTO CACHE ... IGNORE LEAVES
会失败,除非表中的所有索引都具有相同的块大小。To determine index block sizes for a table, use myisamchk -dv and check the 要确定表的索引块大小,请使用Blocksize
column.myisamchk -dv
并检查Blocksize
列。