Hi Dawood, On 02.09.2013, at 16:36, dawood abdullah <muhammed.daw...@gmail.com> wrote:
> Hi > I have a requirement of versioning to be done in Cassandra. > > Following is my column family definition > > create table file_details(id text primary key, fname text, version int, > mimetype text); > > I have a secondary index created on fname column. > > Whenever I do an insert for the same 'fname', the version should be > incremented. And when I retrieve a row with fname it should return me the > latest version row. > > Is there a better way to do in Cassandra? Please suggest what approach needs > to be taken. Can you explain more about your use case? If the version need not be a small number, but could be a timestamp, you could make use of C*'s ordering feature , have the database set the new version as a timestamp and retrieve the latest one with a simple LIMIT 1 query. (I'll explain more when this is an option for you). Jan P.S. Me being a REST/HTTP head, an alarm rings when I see 'version' next to 'mimetype' :-) What exactly are you versioning here? Maybe we can even change the situation from a functional POV? > > Regards, > > Dawood > > > >