In an application, I am using mysql's TEMPORARY TABLE. Since this application does not need permanent tables, I wonder if I can find an alternative RDMS designed for memory tables. I hope to find an in-memory database system, which is

  1. Lightweight
  2. Faster than mysql temporary table
  3. Having an API for C (my programming language)

and no special features is needed, just creating table and performing SQL queries. FK or other advanced features are not needed.


You have two options

OPTION #1 : Create a RAM Disk

service mysql stop
mkdir /var/tmpfs
echo "none   /var/tmpfs  tmpfs  defaults,size=${RAMDISK_SIZE} 1 2" >> /etc/fstab
mount -t tmpfs -o size=${RAMDISK_SIZE} none /var/tmpfs
cp -R /var/lib/mysql/* /var/tmpfs
mv /var/lib/mysql /var/lib/mysql_old
ln -s /var/tmpfs /var/lib/mysql
chown -R mysql:mysql /var/tmpfs
chown -R mysql:mysql /var/lib/mysql
service mysql start

If this does not work, you can reverse it out

service mysql stop
rm -f /var/lib/mysql
mv /var/lib/mysql_old /var/lib/mysql
service mysql start    

You can set the RAMDISK_SIZE to your liking


Mount /var/lib/mysql on a FusionIO Disk (all memory, CPU aggressive).

Have fun clearing this with your CFO.


Both of these options allow you to use MyISAM and InnoDB as you normally would. The goal is simply to place the entire datdair in RAM.

Give it a Try !!!

  • 2
    FusionIO is much faster than old mechanical disk drives, but it is not RAM. It uses flash memory, which still has latency in microseconds. SDRAM has latency on the order of nanoseconds. Oct 1 '13 at 20:52

Look at MySQL NDBD cluster. It's MySQL database with in-memory storage.


Have you looked at SQLite? It is a widely used, light-weight database which has C/C++ bindings and supports in memory databases.

  • SQLite is lightweight, but it does not have the mysql server, and in my experience there is no performance advantage over mysql.
    – Googlebot
    Aug 26 '13 at 16:55

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