[erlang-questions] mnesia:update_element
Musumeci, Antonio S
Antonio.Musumeci@REDACTED
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: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On Behalf Of Pascal Chapier
Sent: Wednesday, September 15, 2010 4:44 AM
To: erlang-questions@REDACTED
Subject: [erlang-questions] mnesia:update_element
Hello,
Concerning Mnesia there is a powerful update mechanism with:
mnesia:transaction(UpdateFunc(Parameters)),
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 ?).
PC
More information about the erlang-questions
mailing list