Jump to content

[SOLVED] RAM


Azu

Recommended Posts

Is it possible to make it so that certain tables are stored entirely in RAM so that the hardrive does not need to be accessed no matter how much it is used, and it just saves it to hardrive every once in a while in case the power goes out or something? And if it is please tell me how ^_^

 

I use MyIsam btw..

Link to comment
https://forums.phpfreaks.com/topic/44462-solved-ram/
Share on other sites

You can use Memory (or Heap) tables which are created in RAM and these are extremely fast- however  should only be used as temporary tables as all data is lost if there is a system shutdown - The Table structure is preserved (since this is stored as .frm files) but the contents will be deleted

 

CREATE TABLE memory_table ENGINE=MEMORY;
or if using a MYSQL version < 4.1
CREATE TABLE memory_table TYPE=HEAP; 

 

If the data is fairly static you could create a cron job to copy the MEMORY tables to a more permanent table (such as a MyISAM one) every now and then - The same job could be used to reload the MEMORY tables from this permanent backup table if they are found to be empty (i.e. after a server restart) using a INSERT INTO memory_table SELECT * FROM backup_table; command

Link to comment
https://forums.phpfreaks.com/topic/44462-solved-ram/#findComment-216072
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.