[erlang-questions] mnesia:update_element

Musumeci, Antonio S <>
Wed Sep 15 13:29:20 CEST 2010

Obviously there are ways to simulate it but there are situations where you don't care to read then write in a transaction. Where you could do a dirty read and then a dirty update_element. That's going to be faster than dirty read, transaction(wread + write).

-----Original Message-----
From:  [mailto:] On Behalf Of Pascal Chapier
Sent: Wednesday, September 15, 2010 4:44 AM
Subject: [erlang-questions] mnesia:update_element


Concerning Mnesia there is a powerful update mechanism with:

I am not sure that one can find a simpler and more general update(Element) model for actions such as

   add to cart

   remove from cart

   apply 10% discount

   modify phone number...

it can be faster in some cases:

mnesia:dirty_read, updateFunc, mnesia:dirty_write if concurrency is not a problem,

mnesia:dirty_write(#my_table{key = Key, item=Value}), if only item has to be overwritten and my_table is a set (concurrency ?).


NOTICE: If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers. If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.

More information about the erlang-questions mailing list