Spec-Zone .ru
спецификации, руководства, описания, API
|
LOAD INDEX INTO CACHEtbl_index_list
[,tbl_index_list
] ...tbl_index_list
:tbl_name
[PARTITION (partition_list
| ALL)] [[INDEX|KEY] (index_name
[,index_name
] ...)] [IGNORE LEAVES]partition_list
:partition_name
[,partition_name
][, ...]
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
is used only for MyISAM
tables. In MySQL 5.6, it is also supported for 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
is also supported for partitioned MyISAM
tables.
The following statement preloads nodes (index blocks) of indexes for the tables t1
and 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
. It preloads only blocks for the
nonleaf nodes from t2
.
The syntax of LOAD INDEX INTO
CACHE
enables you to specify that only particular indexes from a table should be preloaded. The
current implementation preloads all the table's indexes into the cache, so there is no reason to specify
anything other than the table name.
In MySQL 5.6.11 only, gtid_next
must be set to AUTOMATIC
before issuing
this statement. (Bug #16062608, Bug #16715809, Bug #69045)
In MySQL 5.6, it is possible to preload indexes on specific partitions of partitioned MyISAM
tables. 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 one of
the following 2 statements:
LOAD INDEX INTO CACHE pt PARTITION (ALL);LOAD INDEX INTO CACHE pt;
The two statements just shown are equivalent, and issuing either one of them has exactly the same effect. In
other words, if you wish to preload indexes for all partitions of a partitioned table, then the PARTITION (ALL)
clause is optional.
When preloading indexes for multiple partitions, the partitions do not have to be contiguous, and you are not required to 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. You can determine index block sizes for a table by using myisamchk -dv and checking the Blocksize
column.