Squirrels, Nuts and Databases

Where does a squirrel store its nuts? Why, in a squirrel nut-hiding place, of course.

Despite any appearances to the contrary, this is not a joke. And, according to a software engineer I talked to, it is not as simple an answer as it seems at first reading.

He maintained that it was a scientific fact that squirrels do not remember where they store their nuts. And it doesn’t matter much. When winter comes and a squirrel needs nuts, it just goes looking for them in squirrel nut-hiding places and it finds nuts. It may well find another squirrel’s cache of nuts. Indeed if and when it finds any nuts, it will not know which squirrel put them there anyway – so it doesn’t qualify as nut theft. It may be eating another squirrel’s stash, but it doesn’t matter because the other squirrel will not know that and may even be eating nuts stashed by some other squirrel. Squirrels all over the world are implementing a unique form of squirrel nut socialism.

So what has this to do with databases? According to the software engineer, you can build a data storage strategy in a similar way. Don’t store a file in a specific place, put it in an easily searched place appropriate for a file of that type.

Why? Because this allows you to reorganize that space independently of any processes that use the data, making better use of the space (if you do it right) improving read speeds. And, in theory, you can also build a database that way.

Personally, I’m not convinced, but I like the squirrel story.

  1. No comments yet.
  1. No trackbacks yet.