Rotations & Why a BST Degenerates
In short: a binary search tree is only fast if it's short. Insert keys in sorted order and a plain BST never branches — every new key goes right (or always left), and it degenerates into a linked list: search goes from O(log n) to O(n). A rotation fixes one lopsided spot in three pointer moves, without touching most of the tree and without breaking the BST ordering — everything still reads left-to-right the same way. It's the one move every self-balancing tree in this section builds on.

Inserting ids in order
Quarry's index layer sometimes gets keys that arrive already sorted —
auto-incrementing ids, timestamps, a bulk import from another system in
order. A plain BST insert (less than: go left, else go right) handles
this correctly, but not fast:
Height 8 for 8 keys — every key has exactly one child, a straight line.
Search, insert and delete all become O(n). A balanced arrangement of the
same 8 keys has height 4 (⌈log₂9⌉), and the gap only gets worse as n
grows: 20 keys in order gives height 20 instead of about 5.