Data storage. Rush Flat Consulting OpenQM
Реклама
Реклама
Page 4
Introduction
Thirdly, in the programming language, the typing of variables is not required, and may change within the program. For example:
Temp = 0
...
...
Temp = ‘Q’
These characteristics mean that multi-value databases are flexible, and make it easy to accomplish certain tasks. The flip side of this coin is that it is easy to end up with a database structure that is (a) not defined, (b) only partly defined, or (c) incorrectly defined. Likewise,
it is possible to end up with unexpected data types in the database fields.
Data storage
As noted above, many databases get you to define the field types. One of the reasons they do this is so that numbers can be stored as a numeric data type. What this means is that the integer 123 can be stored as a single byte representation. On the other hand, those databases will typically reserve either 4 or 8 bytes for an integer value, even though only one byte is being used.
Multi-value databases store data as literal strings. Therefore, 123 is stored as the string
“123”, and the field length is 3 characters. If the number changed to “12345” then the field will be expanded to 5 characters.
These variable length fields are achieved by using special characters to delimit the fields in the record. The database counts along the delimiters to find the requested field, value, or subvalue.
Consider an address database. The name and address data fields will typically be 30 characters long in a traditional database. With one name field and four address lines, the record will consume 150 bytes, regardless of much data is actually stored in that space. A multi-value database will use as many bytes as are entered – plus the delimiter characters (5 in this case). If a line is longer than 30 characters, then the multi-value database is able to store the extra characters (where a traditional database cannot) – although you will then have an issue of how to print them if you are restricted to 30 characters on an address label. If a line isn’t used, then the multi-value database will only store a delimiter character.
When storing strings like an address, a multi-value database may only require a third the disk space that a relational database would use because it doesn’t need to reserve space for fields
– it simply uses space when it is required. When storing numbers, it is more evenly balanced, with the multi-value database using more space for large numbers and less for small numbers.
Hashed files
A hashed file consists of a series of groups or buckets. Records are assigned to a group using a pseudo-random method based on the record ID. This is how a multi-value database can find a record quickly if the ID is known. The process is:
➢
The ID is hashed to form a large number.
7 The phrase “Give them enough rope” is often used in discussions regarding multi-value databases. The flexibility and lack of enforcement of rules make it easy to create poorly structured databases, maintained by poorly structured code.
Basically, the integrity of the system is in the hands of the developer(s).
Getting Started in OpenQM - Part 1 © Rush Flat Consulting
Изтегляне
Реклама