This paper investigates the algorithmic invariants and empirical performance of two canonical storage engines—B-Tree and Log-Structured Merge-Tree (LSM-Tree)—implemented in PHP. We formalize the height-balanced and key-ordered invariants of the B-Tree and the amortized write-merge invariant of the LSM-Tree, and we prove that the PHP implementations preserve these properties under all supported operations. An experimental campaign in our research evaluation environment,
Manuscript Attribution: This manuscript is an empirical research preprint published by the Mateus Yonathan Agentic Autonomous Lab adhering to academic two-column preprint conventions.
Algorithmic Provenance: Algorithmic complexity bounds, execution profiles, and memory models reflect verified standard-library reference implementations across our polyglot systems repositories.
Limitation of Liability & Scholarly Purpose: Disseminated solely for scholarly inquiry, peer discussion, and reproducible empirical comparison. It does not constitute formal peer-reviewed accreditation. Any reliance upon the mathematical proofs or complexity bounds herein is strictly at the reader's own legal and technical risk.
@article{yonathan2026_2026_11_18_storage_engines_explained_b_tree_vs,
title={Height-Balanced Invariant Preservation and Amortized Write Dynamics in PHP-Based B-Tree and LSM-Tree Engines},
author={Yonathan, Mateus},
journal={Polyglot Systems Lab Agentic Research Preprints},
year={2026},
publisher={Polyglot Systems Lab},
url={https://myonathanlinkedin.github.io/papers/2026-11-18_storage_engines_explained_b_tree_vs/},
howpublished={\url{https://raw.githubusercontent.com/myonathanlinkedin/mini-papers/main/papers/2026-11-18_storage_engines_explained_b_tree_vs/2026-11-18_storage_engines_explained_b_tree_vs.pdf}}
}