In addition to table scanning, storage engines can implement
methods for non-sequential reading. (Note: this is not "can" but
rather a "must" because certain operations rely on proper
rnd_pos() calls. Two examples of such
operations are multi-table UPDATE and
table.blob_column ORDER BY something). The MySQL server
uses these methods for certain sort operations.
position()] method is called after every call
rnd_next() if the data needs to be
void ha_foo::position(const byte *record)
It stores a "position" of a record in
this->ref. The contents of this "position"
is up to you, whatever value you provide will be returned in a
later call to retrieve the row. The only rule - "position" or a
row must contain enough information to allow you later to
retrieve this very row. Most storage engines will store some
form of offset or a primary key value.
rnd_pos()] method behaves in a similar
fashion to the
rnd_next() method but takes an
int ha_foo::rnd_pos(byte * buf, byte *pos)
*pos parameter contains positioning
information previously recorded using the
A storage engine must locate the row specified by the position
and return it through
*buf in the internal
MySQL row format.