Build Your Own Circular Log with MySQL
dt.deviantart.com
dt.deviantart.com
create table test_table( id integer identity(1), val varchar(max) )
-----
create trigger auto_updater on test_table after insert as
begin
declare @id integer = (select id from inserted)
declare @val varchar = (select val from inserted)
update test_table
set val=@val
where id=@id%10+1
if @id >= 10
delete from test where id=@id
end
Then to insert you just insert. It'll auto-override the correct entry. insert into test_table(val) values ('hooray')
insta-looping for free (syntactically). Though I did write this in t-sql, I'd assume one can pull the same trick in MySQL (identity => autoincrement). You can also have it timestamp while you update.