Erlang/OTP Forums

Author Message

<  Open Telecom Platform (OTP)  ~  Explain mnesia table designations

ultranewb
Posted: Fri Feb 03, 2012 8:05 am Reply with quote
User Joined: 10 Jan 2011 Posts: 10
I was looking into mnesia for an application I'm developing. I'm slightly confused about the table designations of "disc_copies," "disk_only_copies," and "ram_copies," and hoping someone can explain.

Here's my question. Do these designations 1) pertain to the type of TABLE ITSELF that I am defining, or 2) do these designations pertain to some EXTRA COPY (or copies) of the table which I may want?

I will now explain each possibility that I am envisioning, and supply an example with each possibility so as to further explain my question.

Possibility 1 (the designations describe the type of TABLE ITSELF): There can be no table created at all, ever, without the system knowing whether this will be a ram table or a disk table. In other words, before any table is ever created - even the simplest of tables for the simplest of examples - it must be known and declared whether the table in question is ram or disk. If this information is not given, either the table can't be created at all, or some default will be presumed by the system.

Example 1: I want to create a simple toy table with one field in order to play around for an hour. The table does not need to be fault-tolerant, redundant, multiuser, or anything else. There do not need to be duplicates of this table, nor does this table need to reside on other or multiple nodes. However, THE TABLE MUST STILL BE DECLARED AS BEING RAM OR DISK (either explicitly declared, or assumed by the system as a default).

Possibility 2 (the designations describe COPIES of tables): The system defines and handles all tables in some internal format that the user need not know or care about, therefore no table is ever declared as ram or disk under any circumstances whatsoever. Rather, it is EXTRA COPIES of tables that the user might want which are designated as ram or disk. The table itself will be created regardless. But EXTRA COPIES might or might not be created depending on whether they are declared as ram or disk, and whether their nodes are specified.

Example 2: I want to create 2 tables. The first table is explained under example 1. Since there don't need to be extra copies or extra nodes, I don't have to designate this table as ram or disk because those designations pertain to COPIES of tables one might want to have, not TABLES THEMSELVES. The second table needs to be fault-tolerant, redundant, multiuser, multinode, blah blah, therefore I declare that there must be COPIES of this table, and thus I proscribe both the type of copy (ram or disk) and the nodes the copies reside.

Which is it, if either?

Thanks.
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum