from Hacker News

How does a relational database work?

by mgachka on 8/19/15, 9:35 AM with 60 comments

  • by why-el on 8/19/15, 4:47 PM

    Good write up. Another excellent resource straight out of the UC Berkeley Database Group that I keep close by is "Architecture of a Database System"[1] by three researchers in the field. It is very readable.

    [1] http://db.cs.berkeley.edu/papers/fntdb07-architecture.pdf

  • by jandrewrogers on 8/19/15, 5:45 PM

    Good overview of traditional OLTP architectures. As complicated as they look from the article, it is just scratching the surface of a sophisticated implementation. There are many internals common to more advanced designs that are not even mentioned, and the article is already quite long!

    The thing I love most about database engines is that there is probably more hardcore computer science per line of code than any other software system of similar scope. It is a very rich ecosystem for an algorithms and data structures geek.

  • by faragon on 8/20/15, 12:06 AM

    Be careful with theoretical asymptotic complexity (big O) related to execution time. E.g. if your algorithm time complexity is O(1), but internally calls a higher complexity function, e.g. malloc(), implemented with higher complexity, e.g. O(log n), your algorithm time complexity would be O(log n) and not O(1). It could be even worse: on average or typical constant time algorithm could be in reality an O(n) one: e.g. case of hash table reindexation (that's the reason of why many big data structures, including most SQL databases, requiring real time behavior, are implemented as trees, tree hierarchies/division/clustering, instead of big hash tables).
  • by brudgers on 8/19/15, 7:40 PM

    Because I am interested in databases, I found the Se-radio's 2013 interview with Michael Stonebreaker [1] interesting, particularly in regard to traditional database design and more recent ideas:

    http://www.se-radio.net/2013/12/episode-199-michael-stonebra...

    [1]: http://www.theregister.co.uk/2015/03/25/mike_stonebraker_win...

  • by otis_inf on 8/19/15, 7:39 PM

    > When it comes to relational databases, I can’t help thinking that something is missing. They’re used everywhere. There are many different databases: from the small and useful SQLite to the powerful Teradata. But, there are only a few articles that explain how a database works.

    That's because the inner workings are really old, as in: emerged before blogging etc. was popular, hell before the internet was invented.

    In the 'before/early internet days', we read books like 'An introduction to Database Systems' by C.J. Date. (I had to blow the dust off my copy to read the exact title ;)), which are more in depth than this article, but I like the article better, because it's more to the point and easier to understand. Well done!

  • by mgrennan on 8/19/15, 5:03 PM

    Not that Cassandra and Hadoop don't have a place. But because NO-SQL is hot I see lots of young coders (I'm and old DBA) try to turn document store systems into relational databases. They should all be made to read this post.
  • by n0us on 8/19/15, 6:53 PM

    Actually this is the best post I have ever seen on this website.
  • by jlees on 8/19/15, 5:29 PM

    This is also a pretty accessible quick intro to complexity and data structures, nicely done. Definitely the sort of thing I would include as further reading in a beginner course -- some beginners love to understand "why" and this post answers pretty much all the "why" possible.
  • by codezero on 8/20/15, 5:03 AM

    I decided to spend some time digging into SQLite. I highly recommend the overviews of their architecture and the details about each part of the puzzle.

    It's really understandable, very straight forward, even if a lot of it refers to SQLite v2, it still seems very relevant.

    http://www.sqlite.org/arch.html

  • by emehrkay on 8/19/15, 9:22 PM

    I'm I crazy for wanting to write a database after reading this? Noting too serious, just to flex that dev muscle
  • by aikah on 8/19/15, 8:14 PM

    Great Article , I wish a book was written where a simple database with a query language was implemented from start to finish , even a nosql one, I always wanted to implement my own.
  • by buckbova on 8/20/15, 2:24 AM

    I've read sql server internals cover to cover and in many respects this is a much better read. Thank you.
  • by Cakez0r on 8/19/15, 10:07 PM

    > Nowadays, many developers don’t care about time complexity … and they’re right!

    That's a pretty bold statement...

    Very thorough explanations though!

  • by njharman on 8/19/15, 9:04 PM

    I believe that to be the best technical document I've ever read. Surely biased as I learned so much.
  • by 0xCMP on 8/19/15, 9:14 PM

    Wow, I wanted this recently. Anyone know stuff related to graph databases and how those work?
  • by mgrennan on 8/19/15, 9:05 PM

    Good read. How long do your keep your transactions logs and how often do you make backups?
  • by 0xCMP on 8/19/15, 9:14 PM

    Anyone know of any rust based databases being worked on? Relational or otherwise...
  • by beenpoor on 8/19/15, 5:02 PM

    Great article!