[erlang-questions] Mnesia record count

Rick Pettit rpettit@REDACTED
Tue Nov 27 01:07:18 CET 2007


On Mon, Nov 26, 2007 at 05:34:24PM -0600, Rick Pettit wrote:
> 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) ?

Duh, should have paid closer attention to the question before replying.

Come to think of it, I have never needed to know the size of a result set 
ahead of time. I would be interested in the answer if you find one.

Sorry about that,

-Rick



More information about the erlang-questions mailing list