Let's say I have a MyISAM table with a data length of 4.8GB and an index length of 6.2GB. So, a total data size of eleven gig. How much memory would this require, were I to convert it to a MEMORY
table? 11 gig, or more?
MySQL – How Much Memory Will a MEMORY Table Take Up?
memorymyisamMySQL
Related Question
- Mysql – How much memory do I need for innodb buffer pool
- Mysql – Why does a MySQL MEMORY-backed table take so much more space than on disk
- How Table Size Affects Performance in MySQL
- Mysql – Does MySQL reserve memory for MEMORY tables based on max_heap_table_size
- Mysql – INSERT take too much time
- Mariadb – How much space is needed to reclaim space from a table in MyISAM
- MongoDB – Using Too Much Memory
- Mysql – How much memory does the MySQL server variable table_open_cache cause the DBMS to use
Best Answer
The exact memory requirement of a row is calculated from the following formula:
[src]
So, on a 64-bit machine, replace
sizeof(char*)
with 8.You can get an estimate of the
length_of_row
from the Information Schema:Then you add up all your BTREE keys and then HASH keys. Note that it might be worth it space-wise to convert any keys to HASH, as they require less memory.
I was going to mention the limitation of maximum MEMORY size dependent on
max_heap_table_size
, but gbn beat me to it.