Hi Andrzej,

> I have a question about primary keys. As far as I can see you're
> currently using the first field of the relation as a primary key.
> While that's what other databases do (and it is working well), I think
> it would be better to make _records_ themselves primary keys. Since
> records are immutable they are guaranteed to be unique and comparing
> them is essentially free.
Right, and my first "iteration" did exactly this (because I wanted to
stay "pure" relational), but it turned out not to be that practical.
My #1 issue with primary-key-less relations was, how do I update them
efficiently (efficient in terms of LOC and code-complexity, not
runtime efficiency)?. To alter a value of a tuple, I had to store the
tuple as a reference in every place which initiates an update. That
made debugging and working on the repl an extreme unpleasant task. It
also made commuting updates hard, since there was no "stable" primary-
key to rely on. Additionaly, while praktically working with relations,
I hardly found any dataset wich hadn't some kind of unique id.

> I have a feeling that would make whole lot
> of things much easier (no need to check the primary key field for
> uniqueness, no need to implement auto increment mechanisms, foreign
> keys would just become actual records). What do you think about it?
The good news is, that a relation without a "single" primary key
field, is a relation, where every field belongs to the primary-key. Of
course, indexes over mutliple fields are currently not implemented,
but I do consier this an easy task (just look at the clojure.set/index
function, which will generate an index for one or many given fields).

Erik

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to