This is an old revision of the document!
In general, the data files that Omnidex indexes must maintain a consistent structure, meaning that the data has consistent rows and columns. For example, relational database systems allow data to be exported data into data files, and these files are ideal for indexing with Omnidex. Similarly, companies often receive data from vendors or suppliers in this same form, and these files can be indexed directly without having to load the data into a relational database.
Fixed length files will always use the same number of bytes for each column and each row, regardless of the content of the data. No delimiters are used, and instead each column and each row can be located based on its offset within the file. Binary data such as integers, floating point and date datatypes are stored in their native, binary format.
In the example below, each row consumes 44 bytes of the file, with the first row starting at the beginning of the file, the second row beginning at offset 44, the third row beginning at offset 88, and so forth. Note that the STRING datatype stores one more byte than the number of characters allowed, which is storage for the terminating NULL character. Also note that the FLOAT datatype requires 4 bytes regardless of the number of digits displayed, since a binary floating point value always requires 4 bytes of storage.
| Column | STATE | DESCRIPTION | STATE_CODE | REGION | COUNTRY | TAX_RATE |
|---|---|---|---|---|---|---|
| Datatype | CHAR(2) | STRING(31) | CHAR(2) | CHAR(2) | CHAR(2) | FLOAT |
| Storage | 2 bytes | 32 bytes | 2 bytes | 2 bytes | 2 bytes | 4 bytes |
| Offset 0 | AK | Alaska | 02 | PC | US | 0.000 |
| Offset 44 | AL | Alabama | 01 | ES | US | 4.000 |
| Offset 88 | AR | Arkansas | 05 | WS | US | 4.625 |
| Column Datatype Storage | STATE CHAR(2) 2 bytes | DESCRIPTION STRING(31) 32 bytes | STATE_CODE CHAR(2) 2 bytes | REGION CHAR(2) 2 bytes | COUNTRY CHAR(2) 2 bytes | TAX_RATE FLOAT 4 bytes |
|---|---|---|---|---|---|---|
| Offset 0 | AK | Alaska | 02 | PC | US | 0.000 |
| Offset 44 | AL | Alabama | 01 | ES | US | 4.000 |
| Offset 88 | AR | Arkansas | 05 | WS | US | 4.625 |
Raw data files are accessed by creating a table definition in Omnidex that points to the data file. Once this is done, applications can use SQL statements to access the table. Omnidex will process the data in the data file just like it would when accessing a relational table.
In the CREATE TABLE statement, the PHYSICAL clause is used to point to the physical location of the raw data file. This PHYSICAL clause can contain a relative path name (relative to the location of the Omnidex Environment File) such as “dat/states.dat”, or an absolute path name such as “d:/class/lab1/dat/states.dat”. This PHYSICAL clause can also contain wildcard as described below, and can also reference environment variables using a special syntax.
CREATE TABLE "STATES" physical "dat/states.dat" ...
In the example above, a single file was used as the source of data for a table. It is also possible for multiple files to be used as the source of data for a table. As long as the files all share the same record layout, they will all be processed when reading the table. Filesets can be declared as a comma-separated list of files, or they can be declared using wildcards in the filename. In this example, three files are declared individually in the PHYSICAL clause:
CREATE TABLE "STATES" physical "c:/class/lab1/dat/states1.dat, c:/class/lab1/dat/states2.dat, d:/class/lab1/dat/states3.dat" ...
In this second example, wildcards are used to declare these files:
CREATE TABLE "STATES" physical "c:/class/lab1/dat/states*.dat, d:/class/lab1/dat/states*.dat" ...
Files can reside in multiple directories and in multiple drives or volumes to allow a table to span multiple storage devices. Files may also reside on a Storage Area Network (SAN); in fact, this is one of the most common implementations of Omnidex. Files may also reside on simple mapped drives; however, users should expect performance degradation to occur in this scenario.
Wildcards provide a great flexibility since they allow more data to be added to a table by simply moving another file into place. Care should be taken with this approach, though, since the table must be reindexed as soon as new data is in place.
Fixed-length files are often the highest performance and most flexible approach to indexing large amounts of data, but they do have some limitations. These limitations are described below:
See also: