Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where are tables in Mnesia located?

Tags:

erlang

mnesia

I try to compare Mnesia with more traditional databases.

As I understand it tables in Mnesia can be located to (see Memory consumption in Mnesia):

  • ram_copies - tables are stored in ets, so no durability as in ACID.
  • disc_copies - tables are located to ets and dets, so the table can not be bigger than the available memory? And if the table are fragmented, the database can not be bigger than the available memory?
  • disc_only_copies - tables are located dets, so no caching in memory and worse performance. And the size of the table are limited to the size of dets or the table has to be fragmented.

So if I want the performance of doing reads from RAM and the durability of writes to disc, then the size of the tables are very limited compared to a traditional RDBMS like MySQL or PostgreSQL.

I know that Mnesia aren't meant to replace traditional RDBMS:s, but can it be used as a big RDBMS or do I have to look for another database?

The server I will use is a VPS with limited amount of memory, around 512MB, but I want good database performance.

Are disc_copies and the other types of tables in Mnesia so limited as I have understood? Can´t the database be partially on memory and a full copy on disc?

like image 633
Jonas Avatar asked Apr 07 '10 22:04

Jonas


People also ask

What is Mnesia table?

Mnesia is a distributed, soft real-time database management system written in the Erlang programming language. It is distributed as part of the Open Telecom Platform.

How does Mnesia work?

Mnesia is a truly distributed DBMS and the schema is a system table that is replicated on all nodes in a Mnesia system. This function fails if a schema is already present on any of the nodes in NodeList. The function requires Mnesia to be stopped on the all db_nodes contained in parameter NodeList.


1 Answers

The storage capacity of the Mnesia database for the different types of tables has been discussed in this previous SO question:

What is the storage capacity of a Mnesia database?

where a great answer is already available.

Obviously (but I guess you've already seen it) the official doc is available at:

http://www.erlang.org/doc/man/mnesia.html

Also, reading from the Mnesia FAQ:

11.5 How much data can be stored in Mnesia?

Dets uses 32 bit integers for file offsets, so the largest possible mnesia table (for now) is 4Gb.

In practice your machine will slow to a crawl way before you reach this limit.

Finally, Mnesia tables can be fragmented. This is discussed here and there.

These are my 2p.

like image 121
Roberto Aloi Avatar answered Sep 30 '22 09:09

Roberto Aloi