Mnesia and the performance of variable size records
Rudolph van Graan
rvg@REDACTED
Sun Jul 6 12:37:21 CEST 2003
Hi all,
I have a question regarding the use of records with fields where the
content size changes. As an example, take the following record:
-record(some_record,
{key,field1,detailrecords=[]}).
This is stored in mnesia as an ordered set.
What would the performance implications be where you have a large
number of records, where the content of detailrecords is a list, where
the size is not constant? In a relational database, one would normally
define a field with a specific size or of variable length and the
database will allocate pages for the storage of the extra data. How
does mnesia do this? If I have to guess for best performance in
mnesia, the records all need to be more or less the same size? We can
potentially have millions of records like this, but the size of the
variable field is a couple of entries, usually less than 10.
The reason I would want to do this, is to avoid having a table with
detail rows and include the detail rows simply as a list in the master
record. Doing this would avoid a query on a second table, but I am not
sure how the performance of the master table would suffer doing it
this way.
The structure that I would like to represent looks somewhat like:
<Master Record 1>
<Detail Record 1>
<Detail Record 2>
. . .
<Master Record 2>
<Detail Record 1>
<Detail Record 2>
. . .
The relational database schema would have been:
Table 1:
*Key
Data
Data
Table 2:
*Key
*Index
*Data
*Data
My mnesia implementation simply stores the detail records as items in a
list, where the list is a field of the master record. Obviously, this
makes the coding trivial, but what performance implications does this
have?
Thank you again!
Rudolph
More information about the erlang-questions
mailing list