B-Trees and Databases
For years I’ve always known that B-Trees were used in databases, but until I snatched a copy of Principles of Database Systems (printed in 1982) I didn’t really understand how. The book breaks down how data is physically stored on a system and builds on that concept to illustrate how databases work. To keep things brief, records are basically their own data structure and indexes are systems of efficiently providing access to them, and what really struck me is in thinking about it that way that B-Trees really are not implicitly the best data structure for a Database. The tradeoffs really aren’t worth it unless you have large volumes of hierarchical data. So in saying that, I think we need to think more about our data and our application’s relationship with it when we’re designing software. Because it could very well be that an off-the-shelf database system wouldn’t be as performant as a hash-based system you rolled yourself.














