Change not reflected when using ets:update_counter

Hakan Mattsson <>
Tue Oct 11 15:18:37 CEST 2005


On Tue, 11 Oct 2005, Anindya Mozumdar wrote:

AM>    I am using ets:update_counter/3 to update a field in a table which has
AM> been created as follows :
AM> 
AM> mnesia:create_table(my_table,[{disc_copies, [node()]},{attributes,
AM> record_info(fields, my_table)}])
AM> 
AM> While ets:tab2list/1 confirms that the change has actually taken place, it
AM> is lost when I stop and start mnesia again ? Is there any way I can ensure
AM> that the change persists when I stop mnesia ?

You should use mnesia:dirty_update_counter/3.

Avoid using ets to directly access Mnesia tables.

/Håkan


More information about the erlang-questions mailing list