Formula for structure file (.st).

Venma

New Member
Hello,
Someone know if there is a fomula for calculate the the records per block and the blocks per cluster in a .st file for a database 64 bit.
I saw the documentation but I have not been able to create a formula. (I know that i have some limit :) )
Thank for your attention e sorry for my bad english!

Bye.
 

TomBascom

Curmudgeon
There are various ways to do it but they all boil down to something like the following:

( Blocksize in bytes ) / ( average rows per block as shown by dbanalys ), then round up to the next power of 2

Example, 8k block average row size of 113:

8192 / 113 = 72; next power of 2 = 128 so put this table in a storage area whose rows per block is 128

Some formulas go to great lengths to determine the exact amount of free space in a block and account for overhead in records. But the only settings available to change are block size and rows per block - so calculating the ideal number of records in a block ( the "72" above) out to 3 decimal places is not relevant when you are only able to get the RPB value within a power of 2 of the ideal.

You round *up* to the *next* power of 2 because rounding down or truncating would result in unused space in the block. You don't want to go crazy and just use 256 everywhere because that will result in excessive fragmentation (too many small pieces in the blocks) of the records and extra IO operations.

In some very rare cases you might get some fragmentation anyway, generally because the records grow over time. In these rare cases you might see excessively long "RM chains" and you could either use a smaller RPB (and waste space) or adjust the "create limit" and "toss limit" of the storage area (but, frankly, I hardly ever end up messing with create or toss). The more common cause of fragmentation is that fields are added to the record over time as developers develop developments and the records are no longer a good fit for the storage area that they were assigned to. In that case you need to dump, re-assign, and re-load the table.
 
Top