Changes

Jump to navigation Jump to search
24 bytes removed ,  20:54, 18 July 2022
no edit summary
In the example below we have the file for the database used in the atrv.basex example above. The first four bytes provide a big-endian integer value of the total number of different attribute values in the index - in this case 4.
The remainder of the file is made up of ID lists. Each list starts on one of the bytes from atvr.basex - in the case of our example there is a list starting on byte at position 8 (counting starting from 0). The first item in the list is a count of the number of attributes will this value - in our case here it's 1. Then the list has the locations of the attributes - in our case there is only one attribute and it's at a position 8. This means that it is offset 8 positions from the beginning of the database (use [[Commands#INFO_STORAGE{{Command|INFO STORAGE]] }} command to view the order).
<code>00 00 00 04</code><code>[01] 02</code><code>[01] 05</code>'''<code>[01] 08</code>'''<code>[01] 0B</code>
The header tells us that there are 4 attribute values but we can see there are 5 ID lists in the file. One has become orphaned – a new longer list was required to include the newly added attribute and has been appended to the end of the file.
While a database is open, a list of free spaces is maintained and a new list will only be added to the end of the file if there isn't a free space available that is large enough. However, this list of free spaces is lost when the database is closed and future operations will not be aware of any free space available when the database is opened. This, and the fact that small spaces are unlikely to be filled (single bytes for example) mean that the index file may still grow larger than it needs to be. This space can be recovered, as before, by running [[Commands#OPTIMIZE{{Command|OPTIMIZE]]}}.
== Value Index Files ==
These files, txtr.basex and txtl.basex work in the same way as the attribute index files but with references to the text nodes instead of attributes.
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu