1

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.

RolandoMySQLDBA
185k34 gold badges327 silver badges541 bronze badges
asked Aug 26, 2013 at 10:21
2

3 Answers 3

3

You have two options

OPTION #1 : Create a RAM Disk

RAMDISK_SIZE=32g
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

OPTION #2 : Use FUSION IO

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

Have fun clearing this with your CFO.

EPILOGUE

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 !!!

answered Aug 26, 2013 at 13:18
1
  • 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. Commented Oct 1, 2013 at 20:52
0

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

answered Aug 26, 2013 at 14:23
0

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

answered Aug 26, 2013 at 14:27
1
  • SQLite is lightweight, but it does not have the mysql server, and in my experience there is no performance advantage over mysql. Commented Aug 26, 2013 at 16:55

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.