Mnesia. Comlex queries. Best approach

Dmitrii Dimandt dmitriid@REDACTED
Tue Apr 11 10:39:18 CEST 2006


Let's suppose I have a database with more or less the following structure:

-record(users, {id, login, full_name}).
-record(messages, {id, user_id, title, read_flag}).
-record(message_data, {mid, data}).

And let's suppose I have 10 000 users and >100 000 messages and the
messages table grows more or less rapidly, at a rate of at least 1
000+ messages a day.

What is the best way to query the message_data table (from mnesia and
erlang point of view)? With a combined query like

[{User.full_name, Message.title, MessageBody.data} ||
        User <- table(users),
        Message <- table(messages),
        MessageBody <- table(message_data),
        User.id == Message.user_id,
        MessageBody.mid == Message.id
]

or by querying individual tables every time a new row from
message_data is requested?

Thank you



More information about the erlang-questions mailing list