How are 'conventional wisdom' concepts implemented in Mnesia? Referential integrity, replication, high capacity

StackOverflow https://stackoverflow.com/questions/9156293

  •  23-04-2021
  •  | 
  •  

Domanda

I want to learn a functional language and Mnesia seems "killer app" enough for me to learn Erlang. I want some concepts clarified first.

How does Mnesia enforce referential integrity on relations? Old articles say that it is not enforced at the data level. Is it changed now? Or does Erlang and Mnesia provide features that allows us to write provably correct and maintainable code for maintaining referential integrity? Even for transitive relations across n tables?

Does the query language support ad-hoc queries, short of full-text?

What about high-capacity distributed systems? There is a 4GB file limit, right? How can I write 10 (or more) million rows to the database? And will it automatically distribute itself to other nodes, so that it becomes high-availability? This has got to do with fragmentation; I want to know if it is an operational concept I have to worry about everyday.

Can it easily configure so that it does replication across physical locations, like a MySQL master-slave setup?

È stato utile?

Soluzione

it is several questions:

  1. Referential integrity - no, mnesia doesn't keep referential integrity across tables. Mnesia is k/v storage only but provides you atomic transactions even across tables. So you have to keep referential integrity yourself but mnesia helps you with ability to write transaction as functions and enables also nested transactions. Mnesia keeps referential integrity between table and index at max ;-)
  2. Ad-hoc queries - no, it is not work for mnesia but qlc module helps you with this task.
  3. Full-text - no there is not any support for this out of the box. Mnesia ability to write transactions in application language (Erlang) helps you with it but you have to make your own solution.
  4. High-capacity - there are fragmented tables to address bigger data volumes.
  5. High-availability - there is support for this by table replica. (There is also support for replica of table fragments.)
  6. Master-slave - mnesia supports master-master replication out of the box. If you need master-slave replication you have to roll your own solutions with support of transaction log . (See mnesia:subscribe/1 and Mnesia Event Handling.)
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top