Search code examples
indexingfirebird

What kind of indexes does Firebird use and why?


According to the Firebird FAQ, indexes are directional, which means they don't use the classical B-Trees implementation. What do they use?

What are the advantages? Do other databases use it too?


Solution

  • The indexes used by Firebird are B-trees, and they are bi-directional, but in practice this bi-directionality is not used because the reverse direction is considered unreliable. This has to do with the order of updates and how Firebird writes pages. As a result, a read in the reverse direction could skip index pages if that read happens at the same time an index page split occurs.

    See also Firebird for the Database Expert: Episode 3 - On disk consistency:

    If, on the other hand, you need a double linked chain of pages - index pages come to mind, there is no separable relationship. Each page depends on the other and neither can be written first. In fact, Firebird index pages are double-linked, but the reverse link (high to low in a descending index) is handled as unreliable. It's used in recombining index pages from which values have been removed, but not for backward data scans.