Questions tagged [mnesia]

A distributed DataBase Management System used in Erlang applications.

Mnesia is a distributed DataBase Management System (DBMS), appropriate for telecommunications applications and other Erlang applications which require continuous operation and exhibit soft real-time properties.

414 questions
3
votes
2 answers

Erlang - Mnesia - equivalent to "select distinct id from Table"

Hi is there a possibility to make a distinct select request to mnesia ? I could copy the content of one table to ets and since ets is a hash table it could work. But i thought there is maybe a more elegant solution to this problem. Thank you.
Andreas
  • 397
  • 4
  • 18
  • 37
3
votes
2 answers

Mnesia: unexpectedly getting aborted, cyclic transactions

I have a 5 processes that insert/update the same 3 records in a mnesia table. Each of these processes does its insert/updates within a single transaction. I have 5 other process that read these very same 3 records, also within a single…
Jr0
  • 2,131
  • 13
  • 23
3
votes
1 answer

What's the best way to prevent adding a record whose primary key is already present in mnesia?

Suppose I've got a simple record definition: -record(data, {primary_key = '_', more_stuff = '_'}). I want a simple function that adds one of these records to a mnesia database. But I want it to fail if there's already an entry with the same…
offby1
  • 6,767
  • 30
  • 45
3
votes
1 answer

Writing millions records to mnesia table takes up a lot of memory(RAM) and not reclaim even these records are deleted

I am running an Erlang application that often writes millions of records to the mnesia table for making a scheduler. When the time is due, the records get executed and removed from the table. The table is configured with {type, disk_copies}, {type,…
tandathuynh148
  • 190
  • 5
  • 15
3
votes
1 answer

Create several Mnesia tables with the same columns

I want to create the following schema in Mnesia. Have three tables, called t1, t2 and t3, each of them storing elements of the following record: -record(pe, {pid, event}). I tried creating the tables with: Attrs = record_info(fields, pe), Tbls =…
Little Bobby Tables
  • 5,261
  • 2
  • 39
  • 49
3
votes
1 answer

Does Erlang Mnesia select on an ordered_set give a list in Erlang Term order?

In the documentation it isn't clear to me whether I need to iterate through in order with either next or perhaps foldl (it is mentioned that foldr goes in the opposite order to ordered_set so presuambly foldl goes in the same order) or if I can use…
3
votes
2 answers

Merging records for Mnesia

I am trying to refactor some code I have for software that collects current status of agents in a call queue. Currently, for each of the 6 or so events that I listen to, I check in a Mnesia table if an agent exists and change some values in the row…
Jon Gretar
  • 5,372
  • 1
  • 23
  • 22
3
votes
2 answers

Select random record from mnesia

I have an mnesia table t that contains records with a single field x. How can I select a random value x from t? To avoid the entire of process of mathematical pedantry: I don't care about the details of the random number generation, I just want my…
Travis Webb
  • 14,688
  • 7
  • 55
  • 109
3
votes
4 answers

How do you design a schema to efficiently query nested items in a key-value database?

I'm using Mnesia with Erlang, but this question applies to any key-value db like couchdb, etc. I'm trying to break free of the RDBMS thought process, but I can't wrap my head around how to efficiently implement this kind of schema. Say I have a User…
ryeguy
  • 65,519
  • 58
  • 198
  • 260
3
votes
2 answers

Working with Emails (POP3, IMAP, SMTP e.t.c) in Erlang?

How can one handle email related communications pragmatically in Erlang/OTP? Using bash, python or Perl scripts, its possible for one to send out emails. However, in Erlang, i have not yet found an Application or built in function dedicated to…
Muzaaya Joshua
  • 7,736
  • 3
  • 47
  • 86
3
votes
2 answers

How to select only X number of records from mnesia

I want to select only X number of records from mnesia. Do we have any function call which provide this functionality? I am using :mnesia.select to fetch all the records from mnesia table, but I want to fetch only X number of records from mnesia…
3
votes
1 answer

How to Generate AUTO INCREMENT Id in Erlang Mnesia

I am trying to write records to mnesia, and I want to assign a unique Id to every record. Id needs to be auto incremented. For instance i have a table with 3 columns - Id, Name, DOB. Record 1 should have Id = 1, Name = Joe, DOB = 03-05-1994 Record…
3
votes
0 answers

rebar erlang package mnesia replication dynamically

Problem Statement I have created an Erlang package using Rebar3. It is a tar ball which just need to be put in desired OS and get started once you start the node. So like wise there are two nodes, of same kind, in two different linux boxes. Those…
Madhusudan Joshi
  • 4,438
  • 3
  • 26
  • 42
3
votes
1 answer

Structure of mail box

I write simple pop3 server in erlang. Now i want to write mail box store with mnesia or something else databse. What's the most optimal structure of the tables and data-scheme for mail box? Second question. I need advice for db, what do you think…
0xAX
  • 20,957
  • 26
  • 117
  • 206
3
votes
1 answer

Managing incremental counters in mnesia DBMS?

I have realised that mnesia doesnot support auto-increment feature as does MySQL or other RDBMS do.The counters talked about in mnesia documentation are not really well explained. forexample i have found sofar one function in the entire…
Muzaaya Joshua
  • 7,736
  • 3
  • 47
  • 86