Databases Reference
In-Depth Information
Name
Description
index_next_same
It works just like index_next() , but the engine is only
expected to return the next row if it has exactly the same
key as the one that was searched for. On the other hand,
index_next() returns the next row independent of its
key. This method is implemented in the base handler
class by calling index_next() and comparing the key
of the returned row.
records_in_range
This method is used by the optimizer. It takes a range
(a pair or keys—lower and upper bounds of a range;
either one can be unset, meaning an open range) and
returns an approximate number of rows that fit into this
range. This method does not need to be precise, but it
is expected to be fast—the optimizer may call it many
times for different indexes and ranges, before it decides
which one to use to resolve the query.
read_range_first
read_range_next
These two methods work not with individual keys,
but with ranges. The first method takes a range, finds
a matching row and stores it in table->record[0] .
The second method finds another matched row. Just
like index_next() it is usually called in a loop until
no more rows are found. Only engines that benefit from
knowing both range ends in advance will benefit from
implementing these methods; others can rely on the
base class implementation that converts them into a
sequence of index_read() and index_next() calls.
read_multi_range_first
read_multi_range_next
This is an even higher level of batching. The methods
work with an array of ranges. This can be useful for
a clustered storage—the engine can feed all ranges
to the appropriate nodes and start receiving the data
in parallel, instead of requesting one row at time,
wasting a network round-trip per row. Most engines
do not implement these methods—the base class
implementation turns them into a sequence of read_
range_first() and read_range_next() .
preload_keys
This is called when a user runs the LOAD INDEX INTO
CACHE statement. The engine can use it to read index
pages into the memory cache to speed up future index
reads. This is only used by MyISAM.
Search WWH ::




Custom Search