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

David Gould <>
Thu Jan 4 03:11:26 CET 2001


On Wed, Jan 03, 2001 at 06:35:58PM -0500, Shawn Pearce wrote:
> Klacke <> 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.)

Exactly. It really needs to be a per table/per node option.

> 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 could work. 

> 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.

Er, except on 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
> too.

This is how Postgresql, Sybase, and Informix do it too. As far as I know
it is the "usual way". Of course for Mnesia this would want to be a
replicated table indexed on "node, table".

-dg

-- 
David Gould                                                 
SuSE, Inc.,  580 2cd St. #210,  Oakland, CA 94607          510.628.3380
why would you want to own /dev/null? "ooo! ooo! look! i stole nothing!
i'm the thief of nihilism! i'm the new god of zen monks."



More information about the erlang-questions mailing list