Virtual Machinery logo BTree Toolkit
Home Install Manual Application Other Products

The primary purpose of BTree Compression is to reduce the datasets to their smallest possible size. As a BTree is created and records are added and deleted in a haphazard way the BTree becomes 'loose' and the records are not optimally distributed throughout the BTree. Compression corrects this by traversing the BTree sequentially and packing each Data Page as tightly as possible. Having done this it then rebuilds the index pages packing them as tightly as possible. The danger of compression is that each addition to the BTree after the compression will be more likely to generate a page split and will therefore be slower than normal. Compression is a good idea for BTrees that are only added to or changed infrequently. You should use it if you are using the BTree as a read only source - ie if you do not intend to add any more data to the BTree.

Another use of compress is to change the sizes of the dataset pages to make their use more efficient. The optimum page size for Virtual Machinery BTrees is covered in the BTree documentation.

Compress can also be used to fix a corrupt index file. It compresses the data part of the dataset and rebuilds the index file. It is useful if you have a corrupt index set. This can happen if the update of the BTree is interrupted. If this happens (or you suspect it has happened) then you should verify the BTree using the utility described above. If all the errors are in the index part of the dataset then there is a good chance that Fix will be able to rebuild the dataset and you should be able to use it again. You may lose some data but it is only likely to be that which was being updated at the time of the interruption. If the dataset has more problems then you should use the ‘Rescue’ facility.

The illustration above shows the Compress/Fix tab. In order to compress the BTree you need to fill in the name of new BTree dataset and the sizes of the data and index pages. Note that you just need to provide the path and the base file name for the dataset– do not append .dat or .ind. If , for example, you enter NEWFILE then a new dataset consisting of the files NEWFILE.DAT and NEWFILE.IND will be created in the path that you have specified or in the current working directory if no path has been specified. A number of rules govern the index and data page sizes – in summary these are –

Index Page size

  • Must be greater than or equal to the minimum index page size allowed
  • Must be less than or equal to the maximum index page size allowed

Data Page size

  • Must be greater than or equal to the minimum data page size allowed
  • Must be less than or equal to the maximum data page size
  • Must be greater than or equal to the Index Page size chosen
  • Must be an even multiple of the Index Page size chosen

If you need help with this tab at any time then you can press the ‘Help’ button to see more information on the use of this tab.