[erlang-questions] Mnesia Fragmented tables..... feature or bug?

Dan Gudmundsson <>
Tue Oct 17 09:04:57 CEST 2006

That is why the disclaimer is there, you will have to keep iterating
until you get '$end_of_table'. Mnesia doesn't count the results
returned by [d]ets: select, (and only gets one part-table at the time
for fragmented tables).  But you can also get '[]' several times when
iterating select on a disc_only_table.

Mnesia also compensates for the operations you have done previously in the
same transaction. So if you write 3000 records to an empty table and then
do the select (in the same transaction) you will get all 3000 records directly.

The option is there to let you chunk you through a table without using all your
memory, not to give you an exact number of matches.


Eranga Udesh writes:
 > Thanks for the reply. 
 > However my question is when using Fragmented tables and Frag module, the
 > returned result is only by traversing the 1st fragment of the table and is
 > an empty list (if no matching data in 1st fragment), even there matching
 > data in other fragments.
 > Is it due to something I do wrong or that is how it is?
 > Thanks,
 > - Eranga
 > -----Original Message-----
 > From: 
 > [mailto:] On Behalf Of Dan Gudmundsson
 > Sent: Monday, October 16, 2006 6:13 PM
 > To: 
 > Subject: [erlang-questions] Mnesia Fragmented tables..... feature or bug?
 > >From the man page:
 > For efficiency the NObjects is a recommendation only and the result
 > may contain anything from an empty list to all available results.
 > /Dan
 > Eranga Udesh writes:
 >  > Hi,
 >  > 
 >  >  
 >  > 
 >  > In a Fragmented Table, when I ran select/4, I get {Objects, Cont}.
 > According
 >  > to the returned result, it looks to me that select only runs in the First
 >  > Table Fragment, even though the result count is less than the NObjects
 > value
 >  > specified. However, if I iterate select/1 in the Cont returned until
 >  > '$end_of_table', I can get all the other results. I suppose select/4
 > should
 >  > do the iteration in all the Table Fragment, until the returned record
 > count
 >  > becomes > NObjects. Is this a bug or feature in Mnesia Frag Access
 > Module?
 > _______________________________________________
 > erlang-questions mailing list
 > http://www.erlang.org/mailman/listinfo/erlang-questions

Dan Gudmundsson               Project:    Mnesia, Erlang/OTP
Ericsson Utvecklings AB       Phone:      +46  8 727 5762 
UAB/AUL/IO                    Mobile:     +46 70 519 9469
S-125 25 Stockholm            Visit addr: Armborstv 14 

More information about the erlang-questions mailing list