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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.