Alex Rivera | Logout

How do databases work internally?

Asked 2008-10-06T00:47:22.053
84

I've been working with databases for the last few years and I'd like to think that I've gotten fairly competent with using them. However I was reading recently about Joel's Law of Leaky Abstractions and I realised that even though I can write a query to get pretty much anything I want out of a database, I have no idea how the database actually interprets the query. Does anyone know of any good articles or books that explain how databases work internally?

Some specific things I'm interested in are:

  • What does a database actually do to find out what matches a select statement?
  • How does a database interpret a join differently to a query with several "where key1 = key2" statements?
  • How does the database store all its memory?
  • How are indexes stored?
Edit
Report

1 Answer

0

If you want to know more in detail, I'd recommend getting the sqlite sources and having a look at how it does it. It's complete, albeit not at the scale of the larger open source and commercial databases. If you want to know more in detail I recommend The Definitive Guide to SQLite which is not only a great explanation of sqlite, but also one of the most readable technical books I know. On the MySQL side, you could learn from MySQL Performance Blog as well as on the book front the O'Reilly High Performance MySQL (V2) of which the blog is one of the authors.

answered 2008-10-06T02:26:59.870

Your Answer