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
- Lightweight
- Faster than mysql temporary table
- 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.
-
I cannot find anything about the price in your requirement so maybe Oracle Times Ten is a possible option for youmiracle173– miracle1732013年08月26日 12:05:40 +00:00Commented Aug 26, 2013 at 12:05
-
en.wikipedia.org/wiki/List_of_in-memory_databasesDinei– Dinei2016年12月18日 14:48:29 +00:00Commented Dec 18, 2016 at 14:48
3 Answers 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 !!!
-
2FusionIO 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.Bill Karwin– Bill Karwin2013年10月01日 20:52:36 +00:00Commented Oct 1, 2013 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– Googlebot2013年08月26日 16:55:31 +00:00Commented Aug 26, 2013 at 16:55
Explore related questions
See similar questions with these tags.