patternMinor
Move table from InnoDB to Memory
Viewed 0 times
innodbmovememoryfromtable
Problem
I am using mariadb 10.4 with nignx with joomla 4 on Debian 8 system.
Is it possible for a table that is already created with records in a working database to be moved on memory?
I find only tutorial to create the table from scratch not for changing it after it is created.
Is it possible to have some records on the disk and the rest on the memory?
Is it possible for a table that is already created with records in a working database to be moved on memory?
I find only tutorial to create the table from scratch not for changing it after it is created.
Is it possible to have some records on the disk and the rest on the memory?
Solution
Yes:
That said, I must strongly advice against doing this because the contents of memory tables are lost once the MariaDB server is shut down.
InnoDB is perfect for having some rows in memory and some on disk: It will put as much into memory as it can, and if there isn't enough memory for all of them, then it will only keep those that are accessed the most frequently. Also, it will persist the data to disk so that it's not lost when the MariaDB server is shut down.
ALTER TABLE the_table ENGINE=MEMORY;That said, I must strongly advice against doing this because the contents of memory tables are lost once the MariaDB server is shut down.
InnoDB is perfect for having some rows in memory and some on disk: It will put as much into memory as it can, and if there isn't enough memory for all of them, then it will only keep those that are accessed the most frequently. Also, it will persist the data to disk so that it's not lost when the MariaDB server is shut down.
Code Snippets
ALTER TABLE the_table ENGINE=MEMORY;Context
StackExchange Database Administrators Q#242794, answer score: 3
Revisions (0)
No revisions yet.