January 21, 2008

Variants on SimpleDB

Ralf describes SimpleDB, a project for an open source/desktop equivalent, a .NET version, and so on. Who knew that there was so much need for a database manager that could easily lose your data forever (with simple programming errors) and that is a lead-pipe cinch to repeatedly misplace it for a while (the built-in latency issues)?

To wit:

SimpleDB provides a single operation for writing data: PutAttributes(). Identify where you want to put the attributes – into which item in which domain -, hand in the attributes – and you´re done.

This command would write a single attribute to the item with name “123” in domain “contacts”:

PutAttributes(“contacts”, “123”, [“Name”(“Peter”)])

But now watch! If you then issue this command

PutAttribute(“contacts”, “123”, [“Addresses”(“a”)])

you don´t overwrite what´s been stored in the item, but add to it! The same is true for this command:

PutAttribute(“contacts”, “123”, [“Addresses”(“b”)])

Remember that attributes can have several values. Item “123” now looks like this: “123”[“Name”(“Peter”), “Addresses”(“a”, “b”)]. So you better also write the referenced addresses to the domain:

PutAttribute(“contacts”, “a”, [“City”(“London”), “Country”(“GB”)])
PutAttribute(“contacts”, “b”, [“City”(“Hamburg”), “Country”(“Germany”)])

But how then can you overwrite data, e.g. change the name of tis contact? If you just issue a PutAttributes() with the new name, the name will be added as a second value to the existing attribute. To overwrite you need to add a replace-flag to an attribute (I´ll denote it with a “!” after the attribute name):

PutAttributes(“contacts”, “123”, [“Name”!(“Paul”)])

Replacing an attribute like this deletes all (!) existing attribute values and replaces them with the new value.

A word of caution: Amazon´s SimpleDB is supposed to scale. That´s why they distribute it across many servers and need to replicate data all the time. That in turn means, it will take some time until changes you made by PutAttributes() and the other operations ripple through to all relevant servers. So don´t expect to see changes right after you applied them! Otherwise, if you issue a PutAttributes() followed right away by a GetAttributes() for the same data – this could run on a different thread – you might be in for a surprise.

Please subscribe to our feed!

Comments

One Response to “Variants on SimpleDB”

  1. Jason Watkins on January 27th, 2008 6:25 am

    SimpleDB really needs a CAS, so that lost updates are eliminated.

Leave a Reply




Feed: DBMS (database management system), DW (data warehousing), BI (business intelligence), and analytics technology Subscribe to the Monash Research feed via RSS or email:

Login

Search our blogs and white papers

Monash Research blogs

User consulting

Building a short list? Refining your strategic plan? We can help.

Vendor advisory

We tell vendors what's happening -- and, more important, what they should do about it.

Monash Research highlights

Learn about white papers, webcasts, and blog highlights, by RSS or email.