[erlang-questions] Mnesia record count

Rick Pettit <>
Tue Nov 27 00:34:24 CET 2007


On Mon, Nov 26, 2007 at 11:47:44PM +0100, Maarten Engelen wrote:
> Hi,
> 
> Currently I'm building an application that needs to do a lot of record
> checking by counting the number of records in a mnesia table based on
> some condition. Mnesia has been a live saver in the development of
> this application, but I can't find a decent solution to the mnesia
> equivalent of COUNT(*) in SQL. I haven't been able to check the number
> of records a certain query would return without reading the complete
> set of results into a list and getting the length of the list.
> 
> I have been looking into the dirty_update_counter function, but this
> doesn't guarantee anything when I have multiple mnesia nodes.
> 
> Any ideas?

How about mnesia:table_info(Table,size) ?

-Rick



More information about the erlang-questions mailing list