2008/11/7 Scott Lystig Fritchie <span dir="ltr"><<a href="mailto:fritchie@snookles.com">fritchie@snookles.com</a>></span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Marc Sugiyama <<a href="mailto:marcsugiyama@gmail.com">marcsugiyama@gmail.com</a>> wrote:<br>
<br>
ms> I have a large, fragmented mnesia table.  I'm trying to add more<br>
ms> fragments to it (see below).<br>
<br>I'm going to guess that you'll need to use the mnesia dump, filter, and<br>
restore.  Using the same hash function that mnesia_frag uses by default,<br>
your filter would spit out dump records with table names based on 70<br>
fragments instead of your current 10.  Er, and also replace the internal<br>
'pvobject' state (inside the 'schema' table?) that contains the current<br>
fragmentation info with the new fragment number.  And perhaps a few<br>
other bits.<br>
<br></blockquote></div><br>That is going to be very painful and error prone. I've tried it before and it is not pretty. I would do it this way:<br><br>1. Take an mnesia backup<br>2. Delete the fragmented mnesia table from the schema<br>
3. Create it again with the number of fragments you want <br>4. Traverse the backup and re-insert each record and let mnesia spread them across fragments.<br><br>If the whole process of recreating the table takes too long, there are a couple of ways to speed it up. <br>
<br>When doing (3), create the table as a ram_copies table<br>After (4), change the table type to disc_copies using mnesia:change_table_copy_type/3<br><br>Chandru<br>