Description\n-----------\n\nThis article explains how to use HANDLER commands efficiently with MEMORY/HEAP tables.\n\nIf you want to scan a table for different key values, not just search for exact key values, you should create your keys with USING BTREE:\n\n``sql\nCREATE TABLE t1 (a INT, b INT, KEY(a), KEY b USING BTREE (b)) ENGINE=memory;\n`\n\nIn the above table, a is a HASH key that only supports exact matches (=) while b is a BTREE key that you can use to scan the table in key order, starting from start or from a given key value.\n\nThe limitations for HANDLER READ with MEMORY|HEAP tables are:\n\nLimitations for HASH keys\n\n You must use all key parts when searching for a row.\n You can't do a key scan of all values. You can only find all rows with the same key value.\n READ NEXT gives an error 1031 if the tables changed since last read.\n\nLimitations for BTREE keys\n\n READ NEXT gives an error 1031 if the tables changed since last read. This limitation can be lifted in the future.\n\nLimitations for table scans\n\n* READ NEXT gives an error 1031 if the table was truncated since last READ` call.\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/nosql/handler/handler-for-memory-tables