[erlang-questions] mnesia question - fastest way to tell if ordered_set table is empty or not

Chandru chandrashekhar.mullaparthi@REDACTED
Sun Jun 16 23:25:38 CEST 2013


Have you tried this?

mnesia:table_info(Table_name, size).

Chandru

On 16 June 2013 20:14, Jonathan Leivent <jleivent@REDACTED> wrote:

> What is the fastest way, avoiding locking, to tell if an ordered_set
> mnesia table is empty or not?  I'm assuming that if the table is not an
> ordered set, then:
>
>   mnesia:activity(ets, fun mnesia:first/1, [Table]) == '$end_of_table'
>
> is the fastest.  However, if the table is an ordered set, this seems like
> it could take O(logN) time.
>
> Would this be faster?:
>
>  mnesia:activity(ets, fun mnesia:table_info/2, [Table, size]) == 0
>
> Is there a faster alternative?
>
> -- Jonathan
> ______________________________**_________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/**listinfo/erlang-questions<http://erlang.org/mailman/listinfo/erlang-questions>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130616/bdc430da/attachment.htm>


More information about the erlang-questions mailing list