Using MEMORY tables in MySQL is very useful; they are stored in memory and they are usually not so big in order to avoid a huge utilization of RAM. They are very fast.
MEMORY tables are often used to store session user data, chat messages and to store small frames of data from a bigger table in order to achieve great performance.
But, if you use them in a replication environment, you can have some problem due to their "volatility"; MEMORY table rows are lost when the server shuts down.
If you restart a slave host for some reason, you will have empty MEMORY tables on it, while the master host will have the correct ones.
How to populate automatically MEMORY tables at slave start up copying data from master host?
We could use something like LOAD TABLE table_name FROM MASTER, but it's deprecated, so we will use something else.
I have developed a stored procedure you have to create on the …
[Read more]