[erlang-questions] keys for mnesia

Igor Ribeiro Sucupira igorrs@REDACTED
Tue Jan 12 02:51:51 CET 2010


Hi.

I'd also appreciate an answer to that question.  :)

My guess is that the more space-efficient would be the smallest in
binary format. In that case, your second option would be the best:

1> BS = fun(Term) -> erlang:byte_size(term_to_binary(Term)) end.
#Fun<erl_eval.6.13229925>
2> BS({myapp, myattr}).
20
3> BS("myapp.myattr").
16
4> BS(<<"myapp.myattr">>).
18


But I'm not sure.

Best regards.
Igor.

On Mon, Jan 11, 2010 at 11:16 PM, Steve Davis
<steven.charles.davis@REDACTED> wrote:
> Which would be more efficient/recommended to use as the key of a k/v
> pair for an mnesia table:
>
> {myapp, myattr}
>
> or
>
> "myapp.myattr"
>
> or
>
> <<"myapp.myattr">>
>
> ?
>
> BR
> /s
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
>
>


-- 
"The secret of joy in work is contained in one word - excellence. To
know how to do something well is to enjoy it." - Pearl S. Buck.


More information about the erlang-questions mailing list