WL#1988: support for handlers w/o rnd_pos
Affects: Server-4.1
—
Status: Un-Assigned
There should be new flag in table_flags() to show that a handler do not support rnd_pos - that is cannot read arbitrary row based on "position". Only full table scans (or index accesses if max_keys() is non-zero) are supported. rnd_pos() is now a requirement for filesort to work. So if the handler does not set HA_RND_POS flag (as usual we prefer positive flags to negative, like HA_NO_RND_POS) and MySQL needs it for filesort - that is it is not handled via addon field (see filesort.cc) - MySQL should internally create a temp table, copy the table's content there (applying WHERE clause) an then sort the table. Additiona notes: MySQL also require rnd_pos() in the following situations: - Multi-table-updates - Multi-table-deletes - QUICK_ROR_INTERSECT_SELECT (ie search with AND on different keys) - QUICK_ROR_UNION_SELECT (search with OR on different keys) - On duplicate keys, if handler->table_flags & HA_DUPP_POS - UPDATE ... ORDER BY, DELETE ... ORDER BY If the handler doesn't support RND_POS, we need to give an error in case of multi-table-updates/deletes. We also need to disable the above optiomizations. .
Add new Storage Engine flag - HA_CAN_RND_POS filesort should use "addon_field" optimization if tis flag is set
Copyright (c) 2000, 2025, Oracle Corporation and/or its affiliates. All rights reserved.