Mnesia and uniqueness on two keys

Joel Reymont joelr1@REDACTED
Tue Jul 12 17:53:03 CEST 2005


I have a record defined like this:

-record(tick_data, {
       symbol,
       date,
       ticks % tuple
      }).

I create the table like this:

mnesia:create_table(tick_data,
                  [
                   {disc_copies, Nodes},
                   {index, [date]},
                   {type, set},
                   {attributes, record_info(fields, tick_data)}
                  ])

My intent is to have a table where multiple records with the same  
symbol but different dates can coexist. Will the above work or do I  
need to create a bag table?

In other words, does Mnesia expect uniqueness on each keys or do both  
keys work as a composite?

     Thanks, Joel

--
http://wagerlabs.com/uptick






More information about the erlang-questions mailing list