Mnesia disk performance (was RE: multi-attribute mnesia indexes?)

Shawn Pearce spearce@REDACTED
Thu Jan 4 00:35:58 CET 2001

Klacke <klacke@REDACTED> scrawled:
> On Wed, Jan 03, 2001 at 12:07:21PM -0800, David Gould wrote:
> > On Tue, Jan 02, 2001 at 10:05:56PM +0100, Andi Kleen wrote:
> > 
> > How hard would it be to add the capability of specifying a path of some
> > kind to mnesia/dets tables/indexes/logs ets?
> > 
> This would be pretty straightforward, maybe one directory per table
> (specified in create_table) and one directory for the logs

As a create_table option?

    {atomic, ok} = mnesia:create_table(sequence,
	            [{disc_copies, [node()]},
				 {directory, "/mnesia01"},
	             {attributes, record_info(fields, sequence)}])

My only concern is that not all nodes in a distribued database would
want to store the tables necesarily at the same directory path.
(Different drive structures for instance.)

What about making the path always relative to the mnesia directory
given on the command line to erts?  Then if you want to relocate the
files of a table to another disk, you can make a symlink in the mnesia
data directory to point to a directory on the other disk.  So long as
all nodes have the same structure of their mnesia directory, your safe.
This is assuming that all OSes have a good notion of symlinks.  I'm no
Windows guru, but this makes me think that perhaps its not a good idea
to do with Windows.

The other option is to make either in schema or a new table that goes
with schema that records the name of a table, the name of the node
and the directory path of the storage file for the table.  If mnesia
could bring the system tables 'schema' and 'table_storage' online,
and ignore all other tables, the user could move the file, update the
mnesia system table 'table_storage', and then bring the system up the
rest of the way.  Oracle does this.  I'm sure other database vendors do

Maybe rather than store the files in dets they could be stored in
a config file that is parsed at mnesia startup.  That way its changeable
before one starts up mnesia.  If an entry doesn't exist in the config
file, the default location (mnesia directory) could be used.


  ``If this had been a real
    life, you would have
    received instructions
    on where to go and what
    to do.''

More information about the erlang-questions mailing list