Mnesia data partitioning question
Thu Apr 18 19:45:26 CEST 2002
On Wed, 17 Apr 2002 12:11:37 +0200 (MET DST)
Ulf Wiger <> wrote:
> On Tue, 16 Apr 2002, Chris Pressey wrote:
> >Although I don't really expect a concrete answer to this one, I
> >thought it might be interesting to share opinions on the
> >Mnesia lacks the concept of a 'secondary key' - that is, using
> >more than one field to uniquely identify a record. So, is it,
> >generally speaking, wiser to model a many-to-many relationship
> >in Mnesia as:
> >- a 'set' table with a compound key, or
> >- a 'bag' table with an index on a second field?
> I would go for a 'set' table with a compound key.
Thanks (to Chandru as well.) That does seem the saner course.
> I wonder if you've looked at the support for relational
> constraints in the 'rdbms' contrib? It offers support for things
> like cascading delete and "insertion constraints" (e.g. the
> secondary key must identify an existing record in a given table.)
> If you find it lacking in certain respects, I'd be happy to hear
> what you feel would need to be added/changed.
I have looked at it before; it would probably be overkill for the current
project, which is almost at the 'refined prototype' stage and still less
than 25k of source code - much of which is regularly 'drained off' into
other reusable applications, as I discover stuff that is too tightly
integrated. Perhaps it will be called for once it is in regular use.
All my critique of the rdbms package is, like my critique of Erlang, more
one of idealism and beauty, than a lack of doing-what-needs-to-be-done.
It would be nice if record validation were more of a language-level
concept, and if validation was more orthogonal with how type checking is
presently done in the language (here we are back on the topic of guards,
again - instead of the atom 'integer', the function 'is_integer' would
seem more apropriate, and so forth.) But that's only because lack of
orthogonality is one of my pet peeves :)
More information about the erlang-questions