I learned that Y fast tries support amortized loglog(u) time insertions , deletions. and loglog(u) time membership, successor and predecessor operations with O(n) space. So when n is closer to U in dense big data environments Y fast tries seem better than B trees.

But most database systems use Btrees internally. I was wondering whats the reason behind it. Does Xfast tries and Y fast tries have a high constant factor? I think the implementation is complex as Xfast tries require threaded tries (with strings as bits of integers in u) and a doubly linked list. And Y fast tries require Xfast tries to store maximum elements of each Balanced Binary Search tree used internally, and also merging and splitting of these Balanced BSTS. Is the complexity of implementation the reason behind them not being used as widely as B trees. Can someone give an intuition on why B trees are preferred against X fast tries and Y fast tries?


2 Answers 2


Apart from their more complex structure, Y-fast and X-fast trie assumes that data to be stored are integers, while balanced BSTs only assumes that data be from some ordered universe, not necessarily integers.

Also the Y-fast trie uses balanced BST as a secondary structure.

In addition to the points I highlighted, I believe you will be interested in this similar question about the use of Y-fast and X-fast trie in real-world application. The accepted answer for this question along with the other answer have more detailed discussion.

  • $\begingroup$ We can use integers as key and store a reference to other data these tries right. Many databases have primary keys as integers. In MongoDB each document has a unique randomly generated integer as document Id. $\endgroup$
    – thambi
    Feb 28, 2023 at 22:49

On top of the other answer, the reason why any data structure tends to be preferred by databases over any other data structure (e.g. B+-trees over anything else) usually boils down to two factors:

  • Disk I/O performance. You want to minimise the number of disk accesses needed to use or modify the data structure, while also maximising the amount of work that you can do per access.
  • Concurrency and transaction safety. You would like a data structure which can control concurrent access efficiently, and has support for safe transactions with rollback and commit.

For these reasons, databases prefer data structures that are page-structured. Each node or leaf in a B-tree (or variant thereof) can be understood as a fixed-size page.

This eliminates external fragmentation. A "page" is a natural unit for disk I/O which works efficiently with real hardware (medium-sized "bursts" of I/O tend to be more efficient than small accesses on modern busses). And a page can be protected for concurrent access more efficiently than individual nodes in a smaller-ply tree.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.