Syntax\n------\n\nHANDLER tbl_name OPEN [ [AS] alias]\nHANDLER tbl_name READ index_name { = | >= | <= | < } (value1,value2,...)\n    [ WHERE where_condition ] [LIMIT ... ]\nHANDLER tbl_name READ index_name { FIRST | NEXT | PREV | LAST }\n    [ WHERE where_condition ] [LIMIT ... ]\nHANDLER tbl_name READ { FIRST | NEXT }\n    [ WHERE where_condition ] [LIMIT ... ]\nHANDLER tbl_name CLOSE\n\nDescription\n-----------\n\nThe HANDLER statement provides direct access to table storage engine interfaces for key lookups and key or table scans. It is available for at least Aria, Memory, MyISAM and InnoDB tables (and should work with most 'normal' storage engines, but not with system tables, MERGE or views).\n\nHANDLER ... OPEN opens a table, allowing it to be accessible to subsequent HANDLER ... READ statements. The table can either be opened using an alias, or a table name. If opened with an alias, references to this table by further HANDLER statements must use this alias, and not the table name. If opened with a table name qualified by database name, further references to this table must use the unqualified table name. For example, if a table is opened with db1.t1, further references must use t1.\n\nThe table object is only closed when HANDLER ... CLOSE is called by the session, or the session closes, and is not shared by other sessions.\n\nPrepared statements work with HANDLER READ, which gives a much higher performance (50% speedup) as there is no parsing and all data is transformed in binary (without conversions to text, as with the normal protocol).\n\nThe HANDLER command does not work with partitioned tables.\n\nKey Lookup\n\nA key lookup is started with:\n\n``sql\nHANDLER tbl_name READ index_name { = | >= | <= | < }  (value,value) [LIMIT...]\n`\n\nThe values stands for the value of each of the key columns. For most key types, except for HASH keys in MEMORY storage engine, you can use a prefix subset of its columns.\n\nIf you are using LIMIT, then in case of >= or > then there is an implicit NEXT implied, while if you are using <= or < then there is an implicit PREV implied.\n\nAfter the initial read, you can use the following to scan rows in key order:\n\n`sql\nHANDLER tbl_name READ index_name NEXT [ LIMIT ... ]\nor\nHANDLER tbl_name READ index_name PREV [ LIMIT ... ]\n`\n\nNote that the row order is not defined for keys with duplicated values, and will vary from engine to engine.\n\nKey Scans\n\nYou can scan a table in key order by doing this:\n\n`sql\nHANDLER tbl_name READ index_name FIRST [ LIMIT ... ]\nHANDLER tbl_name READ index_name NEXT  [ LIMIT ... ]\n`\n\nAlternatively, if the handler supports backwards key scans (which most do), you can use this:\n\n`sql\nHANDLER tbl_name READ index_name LAST [ LIMIT ... ]\nHANDLER tbl_name READ index_name PREV [ LIMIT ... ]\n`\n\nTable Scans\n\nYou can scan a table in row order by doing this:\n\n`sql\nHANDLER tbl_name READ FIRST [ LIMIT ... ]\nHANDLER tbl_name READ NEXT  [ LIMIT ... ]\n`\n\nLimitations\n\nAs this is a direct interface to the storage engine, some limitations may apply for what you can do and what happens if the table changes. Here are some of the common limitations.\n\nFinding 'Old Rows'\n\nHANDLER READ is not transaction-safe, consistent or atomic. It's okay for the storage engine to return rows that existed when you started the scan, but that were later deleted. This can happen as the storage engine may cache rows as part of the scan from a previous read.\n\nYou may also find rows committed since the scan originally started.\n\nInvisible Columns\n\nHANDLER ... READ also reads the data of invisible columns.\n\nSystem-Versioned Tables\n\nHANDLER ... READ reads everything from system-versioned tables, and so includes row_start and row_end fields, as well as all rows that have since been deleted or changed, including when history partitions are used.\n\nOther Limitations\n\n If you do an ALTER TABLE, all your HANDLERs for that table are automatically closed.\n If you do an ALTER TABLE for a table that is used by some other connection with HANDLER, the ALTER TABLE query waits for the HANDLER to be closed.\n For HASH keys, you must use all key parts when searching for a row.\n For HASH keys, you can't do a key scan of all values. You can only find all rows with the same key value.\n While each HANDLER READ command is atomic, if you do a scan in many steps, some engines may give you error 1020 if the table changed between the commands. Please refer to the specific engine handler page if this happens.\n\nError Codes\n\n Error 1031 (ER_ILLEGAL_HA) Table storage engine for 't1' doesn't have this option\n   If you get this for HANDLER OPEN it means the storage engine doesn't support HANDLER calls.\n   If you get this for HANDLER READ , it means you are trying to use an incomplete HASH key.\n Error 1020 (ER_CHECKREAD`) Record has changed since last read in table '...'\n   This means that the table changed between two reads, and the handler can't handle this case for the given scan.\n\nExamples\n--------\n\nCREATE TABLE t1 (f1 INT);\n\nINSERT INTO t1 VALUES (1),(2),(3);\n\nHANDLER t1 OPEN;\n\nHANDLER t1 READ NEXT;\n+------+\n| f1   |\n+------+\n|    1 |\n+------+\n\nHANDLER t1 READ NEXT;\n+------+\n| f1   |\n+------+\n|    2 |\n+------+\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/nosql/handler/handler-commands