> 
> A round robin queue is fine.  Every so often, to kill off old records do
> 
> SELECT max(rowid) FROM myTable
> 
> then in your code subtract from it however many rows you want to keep, then do
> 
> DELETE FROM myTable WHERE rowid < firstToRetain
> 
> It won't work perfectly but it's simple and fast.
> 

You could even do something like that in an ON INSERT trigger. And with an 
AUTOINCREMENT primary key (see http://www.sqlite.org/autoinc.html)
you would not even have to SELECT max(rowid), as the max rowid is then the 
rowid of the new record.

As a side note: even when run from a separate thread, inserting the log entries 
and deleting old entries would lock the database, thus affecting any main 
thread. You would probably want a separate database for that.

/eno

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to