Wednesday, November 08, 2006

Associative Database Thoughts

Well, this may be madness but I've decided to write my own associative database in Perl. Conceptually, this seems very easy and I did get some code started that seems to work pretty well.

Guess the first thing I need to do is explain why. I know of some people who are using such a product and ran across a significant problem: it isn't cross-platform. If I recall correctly, it's Windows only and they need it to run on a Unix-like OS. Doing this in Perl sounded like a good solution to this since most Perl scripts can be run on different platforms. Of course, I wanted to do something different and this seemed like an interesting programming exercise.

My understanding of an associative database is that it's one giant graph where everything is of the form Subject, Predicate, Object. In other words, node->link->node. No biggie. The way I figure it, I'm going to keep things simple at first with some basic insert/get functions. Initially, I'll keep things in memory, but as soon as I find a method I like, I'll make the data persistent. Oh, and delete functions, of course. Right now things are pretty simple, but as soon as we move to persistent data, I want to ensure that I don't have to load all of the data in memory at the same time.

Speaking of persistent data, I'm currently thinking of some sort of B-Tree, probably a B+Tree, but I'm not sure that's the best way to go. It does give me a nice way to pull data off in chunks, it seems so "been there, done that." I'm not saying it's bad; I just feel the need to use something more interesting.

Granted, I know this will not be the fastest solution, however as I stated before, my two main goals were portability and a challenge. All of the products I've heard about that do this are not open-source, therefore I don't really know how they work, but I have theorized about it. The funny thing is, no matter how I look at it, it seems you have to use some of the same tricks relational databases use in order to get good performance, like indices. This is kind-of ironic considering that associative database proponents claim that this will replace relational databases.

1 Comments:

Blogger Vanessa said...

My husband is so wonderful. Love the blog dear. Well written.

7:54 AM  

Post a Comment

Links to this post:

Create a Link

<< Home