implementing a notification list

Steve Davis <>
Thu Mar 18 16:37:52 CET 2010


HI Martin,

A couple of approaches to consider for a starting point:

1) If appropriate you could use the timestamp as the key on your
db_event record, i.e. -record(db_event, {timestamp, data, ...})
2) If using the timestamp as the key isn't appropriate, you can index
the timestamp field, http://erlang.org/doc/apps/mnesia/Mnesia_chap5.html#id2273564

hth,
/s

On Mar 18, 6:34 am, Martin DeMello <> wrote:
> I'm new to Erlang, and having a bit of trouble coming up with the
> right way to do this:
>
> I have a set of mnesia triggers that watch for various db events. I
> now want to have a persistent notification list that supports the
> following two operations efficiently:
>
> 1. insert a new event, with timestamp
> 2. retrieve all events between two given timestamps
>
> and possibly less efficiently
>
> 3. compact the table (combine several updates to a single object into
> a single row)
>
> This posthttp://groups.google.com/group/erlang-programming/browse_thread/threa...
> seems to imply that simply storing the notifications as an mnesia
> table is a bad idea.
>
> martin
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> Seehttp://www.erlang.org/faq.html
> To unsubscribe; mailto:


More information about the erlang-questions mailing list