[erlang-questions] sending data down the wire in mysql vs. mnesia

Lev Walkin <>
Sat Dec 1 23:13:14 CET 2007


Andrew Arrow wrote:
> I have a PHP + mysql app now that uses a mysql stored procedure to
> avoid sending lots of data "down the wire."  That is, the stored
> procedure iterates over thousands of rows, determines the value the
> app needs and sends back just the value.  This avoids the thousands of
> rows coming down the wire to have PHP compute the value.
> 
> In moving this system to erlang + mnesia do I have to worry about the
> same issue?  It seems I will have to store the thousands of items in a
> set in a mnesia table, retrieve all the rows, and have erlang compute
> the value.  There's no way to do the iteration inside mnesia like
> there is in mysql is there?


You do this "stored procedure" thing in MySQL primarily to avoid
inter-process communication and serialization/deserialization.

In Erlang+Mnesia case, the Mnesia table runs inside Erlang VM,
therefore avoiding inter-process communication issues. Also,
there is some advantage in not having to perform serialization
and deserialization, although with *ts tables (which Mnesia
is based upon) there is some copying going on anyway.

So, the short answer is no, you don't do it in Mnesia. Primarily
because your surrounding Erlang code precisely acts like a "stored
procedure" around Mnesia tables, running in the same VM.


-- 
Lev Walkin




More information about the erlang-questions mailing list