Table E and non-FILEORG X'100' files (File architecture)

From m204wiki
Jump to navigation Jump to search

Holds Large Object Data (BLOBs and CLOBs)

Model 204 stores large objects as consecutive chunks of Table E pages. When large objects are created and deleted frequently, gaps can occur between objects that may not be reused due to their small size.

When FILEORG x'100' is not set on a file, large object storage is enabled by reorganizing / creating a file with ESIZE greater than 0, and then defining one or more fields with an attribute of CLOB or BLOB (the file must have an ESIZE for the latter to occur).

Available as of Model 204 V7.1


Summary

Storage and manipulation of Large Objects (LOBs):

Table E under non FILEORG x'100' files remain a reasonable choice for static stores of Large Objects (scanned forms, for example). If it is expected that there will be large numbers of adds, changes and deletes, strong consideration should be given to Table E with FILEORG x'100'.


Bitmaps to track space availability

In Table E, in addition to the pages used to store the Large Object Data, there are bitmap pages which track the page use. For every 49152 pages of Table E defined, there will be one bitmap page.

The boundaries of these sets of records are a consideration in the execution of the COMPACTE command, as the compactor process one of these sets at a time, and LOBs stored on pages that span a bitmap boundary do not participate in the compaction.

Storing Large Objects

When a field is defined as a large object (LOB) (the attributes BLOB or CLOB) a pointer is stored in the record (in Tables B or X) and the LOB is stored in Table E.

Pointer in the record

When you store a Large Object value in Table E, a Large Object descriptor is stored in Table B (or X depending on where the field is being ADDed). The descriptor contains the length, reserve, and a pointer to the Large Object data in the Table E page and is 27 bytes long or 30 bytes long if the field is not pre-allocated.

Large Object Header

Every large object stored in Table E starts with a Large Object Header (this is used to make the Table E compaction work better. The large object header contains a field for the Table B record number that points to the large object—thus a backward pointer to the Table B record.

Implementing a large object header requires file reorganization if the file was created earlier than V7R1.0. Only V7R1.0 or later files are eligible for COMPACTE processing. No application changes are required.

Note: Files created in V7R1.0 with Table E size greater than zero are not backward compatible and cannot be opened in earlier releases.

The large object header has the following 4-byte entries:

  • Table B record number
  • Large object length in pages, including reserved pages
  • Field attribute

    The field attribute facilitates the Table B record search to find a field with the object descriptor.

  • Five reserved fullwords

So, the first 6132 bytes of a large object are on the first Table E page (while later pages will fit 6144 bytes). If you plan on storing a large number of relatively small LOBs, this size differential needs to be taken into account when sizing Table E.

Table E space utilization

Each instance of a Large Object field occupies an integral number of Table E pages, where each page can hold up to 6144 bytes of data (the first page only 6132 due to the header).

  • A Large Object field with a null value (or 0 bytes of data) occupies no Table E pages.
  • Large Object field data from 1 to 6132 bytes occupies one Table E page. If the data is from 1 to 6131 bytes, the page is not completely filled, so the remainder of the page is unused.
  • Large Object data of 6133 bytes requires two Table E pages, and LOB data of 12277 bytes will take three pages (6132 + 6144 + 1).

Storing a Large Object

The pages used to store a Large Object value are always contiguous in Table E. If you specify the RESERVE option when the data is stored (and you must if you wish the object to expand in size after its initial store), then enough contiguous pages are allocated to hold the full RESERVE length, even if the actual size of the data initially stored is less than that.

If possible, when space to store Large Object data is required from Table E, then the space is allocated from the pages past EHIGHPG—even if there are free pages in Table E before the EHIGHPG point. In other words, data in Table E is initially stored in entry order. Eventually, when there is insufficient space left at the end of Table E, then space is allocated from the unused pages in Table E. Unused pages are a result of deleting Large Object data.

Generally speaking, the cost of finding free space in Table E is very low during the initial phase, when EHIGHPG is still increasing, but more expensive later, particularly when Table E free pages are fragmented: for example, if the Large Object data stored in the file show a wide variation in size.

If the Large Object data stored in your database are volatile because of a high number of deletions and additions, Rocket Software recommends that you use FILEORG x'100' files.

Parameters and commands related to the use of Table E

Name Description
COMPACTE command Defragment the contents of Table E.
EHIGHPG parameter The highest active Table E page. (The first page in Table E is page zero.)
EPGSUSED parameter The number of Table E pages currently in use.
ESIZE parameter The number of pages in Table E.
FILEORG parameter The file organization.