The tabanalys section of a dbanalys reports a Fragments Factor metric.
- A record is fragmented when the entire record cannot fit into the available space in a database block.
- The Fragments Factor value reported by tabanalys/dbanalys is not a simple division of the record fragment count / record count, as this does not take into consideration that records bigger than the database blocksize cannot possibly fit in one block. Tabanalys takes this into consideration when calculating the frag factor.
- The lowest Fragments Factor value is 1.0, which indicates that records are not fragmented. This means the entire record is housed within a single database block, possibly with other records.
- Subtracting the number of records by the fragments count provides a rough idea on the number of records that are fragmented, as some records may hold more than one of the counted fragments.
Example:
----------------------- ------------------------Record Size (B)------Fragments---Scatter
Table Records Size Min Max Mean Count Factor Factor
PUB.Order 13970 590.8K 40 45 43 13970 1.0 1.0
PUB.Customer 101117 87.0M 98 1194 901 116326 1.2 1.0
PUB.OrderLine 1817631 747.2M 289 639 431 2037793 1.1 1.0
The Fragments Factor is unlikely to change much after a dump/load,
provided that the records per block configured for the storage area was correct, because the fragments factor is an average value. For further discussion refer to Articles:
Since OpenEdge 10.1A, online defragmentation was introduced to improve record fragmentation:
Using the appropriate records per block structure is paramount, even with the "online defragmentation" feature which never-the-less has a performance overhead.
Since OpenEdge 12.5, 12.2.7, 11.7.11, fragmentation is reported better for large tables.
Complimentary to dbanalys or tabanalys, is DBTOOL.
Small record fragments may cause a problem when an update to a record that already has a fragment, requires an new fragment and the current small fragment cannot hold the size of the rowid to the next fragment (32->64 bit), DBTOOL Option 6, may be able to fix this without having to dump and load that table.
For specific Table's record structures, the Toss and Create limits can be tuned to improve compaction before loading records to the database:
dbanalys or tabanalys record fragmentation and scatter factor are related but independent metrics: