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