[erlang-questions] beginner: mnesia secondary indices with ordered_set
Ulf Wiger (TN/EAB)
Wed Oct 31 10:28:28 CET 2007
Ulf Wiger wrote:
> No, Mnesia has only one type of index.
> The rdbms contrib in Jungerl implements index tables a bit
> differently (as full mnesia tables), and supports ordered index,
> among other things.
> But to the best of my knowledge, rdbms is not actively used
> by anyone (unless Rudolph van Graan is still using it).
(Replying to myself - sorry)
There is actually another component that supports ordered
indices: Erlhive. It even supports aggregated indices, and
does so without any mnesia patches too (one thing that was
a bit troublesome with rdbms).
Of course, erlhive goes pretty far in abstracting away
mnesia as we know it. You're not allowed to use the
mnesia API directly, and the data model is deliberately
restrictive. On the flip side, it allows you to do things
inside mnesia transactions that would be insane to try
by hand (spawn, send, receive, ets tables, ...).
Indexing is done in a manner similar to that of rdbms.
Aggregated indices can be accomplished through use of
arrays of arrays, where an index is attached at each
appropriate level. Array, in erlhive, is an associative
array, with ordered set semantics.
Transaction overhead is higher than in rdbms, and scalability
is much likely significantly worse (I haven't tested it).
Erlhive wasn't really intended to be used just as a database
component, but I've toyed with the idea of separating the
parts so that it could be.
Uses aggregated indices in a multi-user blogging
back-end implementation. (Find on 'index' to see
where the index parts are declared).
It uses this module as index callback:
More information about the erlang-questions