bdfd1m1t | Database Administration |
The following scenario addresses balancing updating speed against accessing speed.
The application requires a file that can be updated frequently. It also needs frequent access to the latest data in the file. You need to balance the accessing speed against the updating speed.
You can organize the file so that the latest LRECs are inserted at the start of a subfile, ideally in the prime block. To do this, use a transaction number or date as the key, and specify DOWN organization.
This provides fast access for DBRED macros and dfred functions. However, each time you insert a new LREC in the prime block, the TPFDF product has to shuffle LRECs to a new block. This results in poor update performance.
You can organize the file so that new LRECs are added to the end of a subfile. To do this, use a transaction number or date as the key, and specify UP organization.
This provides fast updating, but DBRED macros and dfred functions might be slow. In the prime block, the TPFDF product maintains a backward chain to the last overflow block to ensure fast updates. However, as the TPFDF product has to read through the whole chain to get the latest LREC, DBRED macros or dfred functions could create a considerable overhead.
You could solve the problem by following the fast updating process and using B+Tree or block indexing as well. Alternatively, you could specify "pushdown chaining" for the file by setting &SW00OP1,#BIT3.
The TPFDF product then maintains the latest LRECs in the prime block. When the prime block is full the TPFDF product pushes the data into an overflow block and then clears the prime block and makes it available for new LRECs.
Pushdown chaining requires minimal data shuffling on updates. In addition, DBRED macros and dfred functions always find the latest information in the prime block of the subfile. The TPFDF product does not need to read through long chains. However, older LRECs are still available in overflow blocks, in case they should be needed.
&SW00OP1 SETC '...1....'
No changes are necessary if the changes are made in the DSECT macro.