It is ironic I answered a question earlier about InnoDB vs MEMORY storage enginesInnoDB vs MEMORY storage engines.
There is something very weird about the MEMORY Storage Engine you must consider.
MEMORY tables perform full table locks each time there is an INSERT, UPDATE, and DELETE.
MEMORY tables still trigger a little disk I/O because the .frm file of the MEMORY table is a disk file that must be referenced with each query as far the table's existence goes and query parsing thereafterMEMORY tables still trigger a little disk I/O because the .frm file of the MEMORY table is a disk file that must be referenced with each query as far the table's existence goes and query parsing thereafter.
The default index type for a MEMORY table is the HASH index not BTREE. If you forget to declare USING BTREE, all range searches become table scans. HASH indexes are poor candidates for indexes to fulfill range queries. The query you have in the question body would quickly be victimized by this.
Even if you create indexing in the MEMORY table with the USING BTREE clause, BTREE indexes in RAM grow at a pace of O(log n) so expect disk I/O again for checking the index definition in the .frm file plus O(log n) running time on page access.
Another crazy thing to think about when using the MEMORY storage engine is this : If you try to join a MEMORY table and an InnoDB table, the resulting lock behavior defaults to the worst one, which in this case is full table locking.
CAVEAT
Others have answered question like this back in March 2011
- David Splllett's answer to What are reasons **NOT** to use the MEMORY storage engine in MySQL?What are reasons **NOT** to use the MEMORY storage engine in MySQL?
- Morgan Tocker's answer to What are reasons **NOT** to use the MEMORY storage engine in MySQL?What are reasons **NOT** to use the MEMORY storage engine in MySQL?
Here is one on why an all memory Database is good or bad : Is it feasible to have MySQL in-memory storage engine utilize 512 GB of RAM?Is it feasible to have MySQL in-memory storage engine utilize 512 GB of RAM?