Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to load an entire MySQL database to the RAM, especially on en EC2 server?

  1. The database is quite small (~500 MegaBytes)
  2. I have enough memory
  3. Speed issues are crucial - the resulted queries are used to serve a dynamic webpage.



share|improve this question
up vote 1 down vote accepted

You can certainly load indexes into cache; if you have small ISAM tables that are frequently queried, MySQL will probably load these into cache as well. Here is a good Performance Wiki article on MySQL tuning.

share|improve this answer

You could store the database on a RAM disk, such as ramfs. This could potentially risk the data, depending on the implementation, so you would need to design to compensate for this. One potential solution would be to have a readonly slave replicating to a RAM disk and the data there could be disposable.

MySQL Clustering (NDB engine) is designed to store data in memory. However, MySQL clustering is best suited for small datasets accessed with simple queries.

A favorite solution is memcached these days but this requires application architecture to support the technology.

This is a fairly big question. High Performance MySQL is a fantastic book that covers high level MySQL implementations.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.