incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Rhoden <jacob.rho...@me.com>
Subject Best data structure for tracking most recent updates.
Date Fri, 08 Nov 2013 23:02:16 GMT
I need to be able to show the most recent changes that have occurred in a system, I understand
inserting every update into a tracking table and deleting old updates may not be great, as
I may end up creating millions of tombstones. i.e. don't do this:

create table recent_updates(uuid timeuuid primary key, message text);
insert into recent_updates(now(), 'the message');
insert into recent_updates(now(), 'the message');
....
insert into recent_updates(now(), 'the message');
// delete all but the most recent ten messages.

So how do people solve it? The following option occurs to me, but I am not sure if its the
best option:

create table recent_updates(record int primary key, message text, uuid timeuuid);
insert into recent_updates(1, 'the message', now());
insert into recent_updates(2, 'the message', now());
....
insert into recent_updates(10, 'the message', now());
// rotate back to 1
insert into recent_updates(1, 'the message', now());

Doing it this way would require a query to find out what number in the sequence we are up
to.

Best regards,
Jacob
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
    • Unnamed multipart/related (inline, None, 0 bytes)
View raw message