[erlang-questions] MNESIA ram-only

Roberto Ostinelli roberto.ostinelli@REDACTED
Mon Mar 9 21:28:20 CET 2015


Hi Dan,
The default is actually disc_opt which then falls back to ram (since there's no schema on disk).

My question though is: any risks / other tradeoffs I should be aware of by doing this, instead of having a disk schema?

Thanks,
r.


> On 09/mar/2015, at 21:19, Dan Gudmundsson <dangud@REDACTED> wrote:
> 
> Sure, you do not need to specify schema_location ram since that is the default if
> no schema exists on disc.
> 
> Just be sure that all nodes in cluster are in the nodes() list.
> 
> /Dan
> 
>> On Mon, Mar 9, 2015 at 4:11 PM, Roberto Ostinelli <roberto@REDACTED> wrote:
>> Dear list,
>> I am starting MNESIA in RAM only mode, with the option [1]:
>> 
>>       -mnesia schema_location ram.
>> 
>> Every time I start a gen_server, I first ensure to add all the other nodes in the island like so:
>> 
>>       mnesia:change_config(extra_db_nodes, [node() | nodes()]).
>> 
>> I then create the table I need:
>> 
>>       mnesia:create_table(cometa_online_devices, [
>>           {type, set},
>>           {ram_copies, [node() | nodes()]},
>>           {attributes, record_info(fields, my_record)},
>>           {index, [#my_record.pid]},
>>           {storage_properties, [{ets, [{read_concurrency, true}]}]}
>>       ])
>> 
>> I do so mainly to avoid the hassle of creating a schema. As you can see I only use ram tables.
>> 
>> My question here is: is this an appropriate use? What kind of problems may I get myself into by not using a disc schema?
>> 
>> Thank you,
>> r.
>> 
>> 
>> 
>> [1] http://www.erlang.org/doc/apps/mnesia/Mnesia_chap5.html#id76396
>> 
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150309/9c3267d4/attachment.htm>


More information about the erlang-questions mailing list